diff options
author | Aleksey Kladov <[email protected]> | 2019-07-24 10:38:21 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-07-24 10:49:19 +0100 |
commit | 459241f272748ff2e57b2c7e84f5a04f78d67edb (patch) | |
tree | 2353f8f068962313d0b2748aab58b71c4ca456d2 /crates/ra_syntax/tests/data/parser/ok/0035_weird_exprs.rs | |
parent | 4d544fbf9b664b6a29d358d3cb41cdd7cd15e4d6 (diff) |
move syntax tests to unit tests
Diffstat (limited to 'crates/ra_syntax/tests/data/parser/ok/0035_weird_exprs.rs')
-rw-r--r-- | crates/ra_syntax/tests/data/parser/ok/0035_weird_exprs.rs | 154 |
1 files changed, 0 insertions, 154 deletions
diff --git a/crates/ra_syntax/tests/data/parser/ok/0035_weird_exprs.rs b/crates/ra_syntax/tests/data/parser/ok/0035_weird_exprs.rs deleted file mode 100644 index 8c1323163..000000000 --- a/crates/ra_syntax/tests/data/parser/ok/0035_weird_exprs.rs +++ /dev/null | |||
@@ -1,154 +0,0 @@ | |||
1 | //! Adapted from a `rustc` test, which can be found at | ||
2 | //! https://github.com/rust-lang/rust/blob/6d34ec18c7d7e574553f6347ecf08e1e1c45c13d/src/test/run-pass/weird-exprs.rs. | ||
3 | //! | ||
4 | //! Reported to rust-analyzer in https://github.com/rust-analyzer/rust-analyzer/issues/290 | ||
5 | |||
6 | #![allow(non_camel_case_types)] | ||
7 | #![allow(dead_code)] | ||
8 | #![allow(unreachable_code)] | ||
9 | #![allow(unused_parens)] | ||
10 | |||
11 | #![recursion_limit = "128"] | ||
12 | |||
13 | use std::cell::Cell; | ||
14 | use std::mem::swap; | ||
15 | |||
16 | // Just a grab bag of stuff that you wouldn't want to actually write. | ||
17 | |||
18 | fn strange() -> bool { let _x: bool = return true; } | ||
19 | |||
20 | fn funny() { | ||
21 | fn f(_x: ()) { } | ||
22 | f(return); | ||
23 | } | ||
24 | |||
25 | fn what() { | ||
26 | fn the(x: &Cell<bool>) { | ||
27 | return while !x.get() { x.set(true); }; | ||
28 | } | ||
29 | let i = &Cell::new(false); | ||
30 | let dont = {||the(i)}; | ||
31 | dont(); | ||
32 | assert!((i.get())); | ||
33 | } | ||
34 | |||
35 | fn zombiejesus() { | ||
36 | loop { | ||
37 | while (return) { | ||
38 | if (return) { | ||
39 | match (return) { | ||
40 | 1 => { | ||
41 | if (return) { | ||
42 | return | ||
43 | } else { | ||
44 | return | ||
45 | } | ||
46 | } | ||
47 | _ => { return } | ||
48 | }; | ||
49 | } else if (return) { | ||
50 | return; | ||
51 | } | ||
52 | } | ||
53 | if (return) { break; } | ||
54 | } | ||
55 | } | ||
56 | |||
57 | fn notsure() { | ||
58 | let mut _x: isize; | ||
59 | let mut _y = (_x = 0) == (_x = 0); | ||
60 | let mut _z = (_x = 0) < (_x = 0); | ||
61 | let _a = (_x += 0) == (_x = 0); | ||
62 | let _b = swap(&mut _y, &mut _z) == swap(&mut _y, &mut _z); | ||
63 | } | ||
64 | |||
65 | fn canttouchthis() -> usize { | ||
66 | fn p() -> bool { true } | ||
67 | let _a = (assert!((true)) == (assert!(p()))); | ||
68 | let _c = (assert!((p())) == ()); | ||
69 | let _b: bool = (println!("{}", 0) == (return 0)); | ||
70 | } | ||
71 | |||
72 | fn angrydome() { | ||
73 | loop { if break { } } | ||
74 | let mut i = 0; | ||
75 | loop { i += 1; if i == 1 { match (continue) { 1 => { }, _ => panic!("wat") } } | ||
76 | break; } | ||
77 | } | ||
78 | |||
79 | fn evil_lincoln() { let _evil = println!("lincoln"); } | ||
80 | |||
81 | fn dots() { | ||
82 | assert_eq!(String::from(".................................................."), | ||
83 | format!("{:?}", .. .. .. .. .. .. .. .. .. .. .. .. .. | ||
84 | .. .. .. .. .. .. .. .. .. .. .. ..)); | ||
85 | } | ||
86 | |||
87 | fn u8(u8: u8) { | ||
88 | if u8 != 0u8 { | ||
89 | assert_eq!(8u8, { | ||
90 | macro_rules! u8 { | ||
91 | (u8) => { | ||
92 | mod u8 { | ||
93 | pub fn u8<'u8: 'u8 + 'u8>(u8: &'u8 u8) -> &'u8 u8 { | ||
94 | "u8"; | ||
95 | u8 | ||
96 | } | ||
97 | } | ||
98 | }; | ||
99 | } | ||
100 | |||
101 | u8!(u8); | ||
102 | let &u8: &u8 = u8::u8(&8u8); | ||
103 | crate::u8(0u8); | ||
104 | u8 | ||
105 | }); | ||
106 | } | ||
107 | } | ||
108 | |||
109 | fn fishy() { | ||
110 | assert_eq!(String::from("><>"), | ||
111 | String::<>::from::<>("><>").chars::<>().rev::<>().collect::<String>()); | ||
112 | } | ||
113 | |||
114 | fn union() { | ||
115 | union union<'union> { union: &'union union<'union>, } | ||
116 | } | ||
117 | |||
118 | fn special_characters() { | ||
119 | let val = !((|(..):(_,_),__@_|__)((&*"\\",'🤔')/**/,{})=={&[..=..][..];})// | ||
120 | ; | ||
121 | assert!(!val); | ||
122 | } | ||
123 | |||
124 | fn punch_card() -> impl std::fmt::Debug { | ||
125 | ..=..=.. .. .. .. .. .. .. .. .. .. .. ..=.. .. | ||
126 | ..=.. ..=.. .. .. .. .. .. .. .. .. ..=..=..=.. | ||
127 | ..=.. ..=.. ..=.. ..=.. .. ..=..=.. .. ..=.. .. | ||
128 | ..=..=.. .. ..=.. ..=.. ..=.. .. .. .. ..=.. .. | ||
129 | ..=.. ..=.. ..=.. ..=.. .. ..=.. .. .. ..=.. .. | ||
130 | ..=.. ..=.. ..=.. ..=.. .. .. ..=.. .. ..=.. .. | ||
131 | ..=.. ..=.. .. ..=..=.. ..=..=.. .. .. ..=.. .. | ||
132 | } | ||
133 | |||
134 | fn ktulhu() { | ||
135 | ;;;();;;;;;;;;() | ||
136 | } | ||
137 | |||
138 | pub fn main() { | ||
139 | strange(); | ||
140 | funny(); | ||
141 | what(); | ||
142 | zombiejesus(); | ||
143 | notsure(); | ||
144 | canttouchthis(); | ||
145 | angrydome(); | ||
146 | evil_lincoln(); | ||
147 | dots(); | ||
148 | u8(8u8); | ||
149 | fishy(); | ||
150 | union(); | ||
151 | special_characters(); | ||
152 | punch_card(); | ||
153 | ktulhu(); | ||
154 | } | ||