]> git.lizzy.rs Git - rust.git/blob - tests/ui/unicode.rs
Auto merge of #9684 - kraktus:ref_option_ref, r=xFrednet
[rust.git] / tests / ui / unicode.rs
1 // run-rustfix
2 // compile-flags: --test
3 #![allow(dead_code)]
4
5 #[warn(clippy::invisible_characters)]
6 fn zero() {
7     print!("Here >​< is a ZWS, and ​another");
8     print!("This\u{200B}is\u{200B}fine");
9     print!("Here >­< is a SHY, and ­another");
10     print!("This\u{ad}is\u{ad}fine");
11     print!("Here >⁠< is a WJ, and ⁠another");
12     print!("This\u{2060}is\u{2060}fine");
13 }
14
15 #[warn(clippy::unicode_not_nfc)]
16 fn canon() {
17     print!("̀àh?");
18     print!("a\u{0300}h?"); // also ok
19 }
20
21 mod non_ascii_literal {
22     #![deny(clippy::non_ascii_literal)]
23
24     fn uni() {
25         print!("Üben!");
26         print!("\u{DC}ben!"); // this is ok
27     }
28
29     // issue 8013
30     fn single_quote() {
31         const _EMPTY_BLOCK: char = '▱';
32         const _FULL_BLOCK: char = '▰';
33     }
34
35     #[test]
36     pub fn issue_7739() {
37         // Ryū crate: https://github.com/dtolnay/ryu
38     }
39
40     mod issue_8263 {
41         #![deny(clippy::non_ascii_literal)]
42
43         // Re-allow for a single test
44         #[test]
45         #[allow(clippy::non_ascii_literal)]
46         fn allowed() {
47             let _ = "悲しいかな、ここに日本語を書くことはできない。";
48         }
49
50         #[test]
51         fn denied() {
52             let _ = "悲しいかな、ここに日本語を書くことはできない。";
53         }
54     }
55 }
56
57 fn main() {
58     zero();
59     canon();
60 }