diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir_expand/src/proc_macro.rs | 4 | ||||
-rw-r--r-- | crates/ide/src/syntax_tree.rs | 28 | ||||
-rw-r--r-- | crates/ide_db/src/helpers/insert_use/tests.rs | 2 | ||||
-rw-r--r-- | crates/mbe/src/tests.rs | 10 | ||||
-rw-r--r-- | crates/proc_macro_srv/src/tests/mod.rs | 8 | ||||
-rw-r--r-- | crates/proc_macro_srv/src/tests/utils.rs | 2 |
6 files changed, 27 insertions, 27 deletions
diff --git a/crates/hir_expand/src/proc_macro.rs b/crates/hir_expand/src/proc_macro.rs index 1923daca5..75e950816 100644 --- a/crates/hir_expand/src/proc_macro.rs +++ b/crates/hir_expand/src/proc_macro.rs | |||
@@ -135,7 +135,6 @@ mod tests { | |||
135 | let result = format!("{:#?}", remove_derive_attrs(&tt).unwrap()); | 135 | let result = format!("{:#?}", remove_derive_attrs(&tt).unwrap()); |
136 | 136 | ||
137 | assert_eq_text!( | 137 | assert_eq_text!( |
138 | &result, | ||
139 | r#" | 138 | r#" |
140 | SUBTREE $ | 139 | SUBTREE $ |
141 | PUNCH # [alone] 0 | 140 | PUNCH # [alone] 0 |
@@ -150,7 +149,8 @@ SUBTREE $ | |||
150 | PUNCH : [alone] 19 | 149 | PUNCH : [alone] 19 |
151 | IDENT u32 20 | 150 | IDENT u32 20 |
152 | "# | 151 | "# |
153 | .trim() | 152 | .trim(), |
153 | &result | ||
154 | ); | 154 | ); |
155 | } | 155 | } |
156 | } | 156 | } |
diff --git a/crates/ide/src/syntax_tree.rs b/crates/ide/src/syntax_tree.rs index 1d4bac7ad..4c63d3023 100644 --- a/crates/ide/src/syntax_tree.rs +++ b/crates/ide/src/syntax_tree.rs | |||
@@ -111,7 +111,6 @@ mod tests { | |||
111 | let syn = analysis.syntax_tree(file_id, None).unwrap(); | 111 | let syn = analysis.syntax_tree(file_id, None).unwrap(); |
112 | 112 | ||
113 | assert_eq_text!( | 113 | assert_eq_text!( |
114 | syn.trim(), | ||
115 | r#" | 114 | r#" |
116 | [email protected] | 115 | [email protected] |
117 | [email protected] | 116 | [email protected] |
@@ -127,7 +126,8 @@ [email protected] | |||
127 | [email protected] "{" | 126 | [email protected] "{" |
128 | [email protected] "}" | 127 | [email protected] "}" |
129 | "# | 128 | "# |
130 | .trim() | 129 | .trim(), |
130 | syn.trim() | ||
131 | ); | 131 | ); |
132 | 132 | ||
133 | let (analysis, file_id) = fixture::file( | 133 | let (analysis, file_id) = fixture::file( |
@@ -143,7 +143,6 @@ fn test() { | |||
143 | let syn = analysis.syntax_tree(file_id, None).unwrap(); | 143 | let syn = analysis.syntax_tree(file_id, None).unwrap(); |
144 | 144 | ||
145 | assert_eq_text!( | 145 | assert_eq_text!( |
146 | syn.trim(), | ||
147 | r#" | 146 | r#" |
148 | [email protected] | 147 | [email protected] |
149 | [email protected] | 148 | [email protected] |
@@ -176,7 +175,8 @@ [email protected] | |||
176 | [email protected] "\n" | 175 | [email protected] "\n" |
177 | [email protected] "}" | 176 | [email protected] "}" |
178 | "# | 177 | "# |
179 | .trim() | 178 | .trim(), |
179 | syn.trim() | ||
180 | ); | 180 | ); |
181 | } | 181 | } |
182 | 182 | ||
@@ -186,7 +186,6 @@ [email protected] | |||
186 | let syn = analysis.syntax_tree(range.file_id, Some(range.range)).unwrap(); | 186 | let syn = analysis.syntax_tree(range.file_id, Some(range.range)).unwrap(); |
187 | 187 | ||
188 | assert_eq_text!( | 188 | assert_eq_text!( |
189 | syn.trim(), | ||
190 | r#" | 189 | r#" |
191 | [email protected] | 190 | [email protected] |
192 | [email protected] "fn" | 191 | [email protected] "fn" |
@@ -201,7 +200,8 @@ [email protected] | |||
201 | [email protected] "{" | 200 | [email protected] "{" |
202 | [email protected] "}" | 201 | [email protected] "}" |
203 | "# | 202 | "# |
204 | .trim() | 203 | .trim(), |
204 | syn.trim() | ||
205 | ); | 205 | ); |
206 | 206 | ||
207 | let (analysis, range) = fixture::range( | 207 | let (analysis, range) = fixture::range( |
@@ -216,7 +216,6 @@ [email protected] | |||
216 | let syn = analysis.syntax_tree(range.file_id, Some(range.range)).unwrap(); | 216 | let syn = analysis.syntax_tree(range.file_id, Some(range.range)).unwrap(); |
217 | 217 | ||
218 | assert_eq_text!( | 218 | assert_eq_text!( |
219 | syn.trim(), | ||
220 | r#" | 219 | r#" |
221 | [email protected] | 220 | [email protected] |
222 | [email protected] | 221 | [email protected] |
@@ -234,7 +233,8 @@ [email protected] | |||
234 | [email protected] ")" | 233 | [email protected] ")" |
235 | [email protected] ";" | 234 | [email protected] ";" |
236 | "# | 235 | "# |
237 | .trim() | 236 | .trim(), |
237 | syn.trim() | ||
238 | ); | 238 | ); |
239 | } | 239 | } |
240 | 240 | ||
@@ -253,7 +253,6 @@ fn bar() { | |||
253 | ); | 253 | ); |
254 | let syn = analysis.syntax_tree(range.file_id, Some(range.range)).unwrap(); | 254 | let syn = analysis.syntax_tree(range.file_id, Some(range.range)).unwrap(); |
255 | assert_eq_text!( | 255 | assert_eq_text!( |
256 | syn.trim(), | ||
257 | r#" | 256 | r#" |
258 | [email protected] | 257 | [email protected] |
259 | [email protected] | 258 | [email protected] |
@@ -270,7 +269,8 @@ [email protected] | |||
270 | [email protected] "\n" | 269 | [email protected] "\n" |
271 | [email protected] "}" | 270 | [email protected] "}" |
272 | "# | 271 | "# |
273 | .trim() | 272 | .trim(), |
273 | syn.trim() | ||
274 | ); | 274 | ); |
275 | 275 | ||
276 | // With a raw string | 276 | // With a raw string |
@@ -287,7 +287,6 @@ fn bar() { | |||
287 | ); | 287 | ); |
288 | let syn = analysis.syntax_tree(range.file_id, Some(range.range)).unwrap(); | 288 | let syn = analysis.syntax_tree(range.file_id, Some(range.range)).unwrap(); |
289 | assert_eq_text!( | 289 | assert_eq_text!( |
290 | syn.trim(), | ||
291 | r#" | 290 | r#" |
292 | [email protected] | 291 | [email protected] |
293 | [email protected] | 292 | [email protected] |
@@ -304,7 +303,8 @@ [email protected] | |||
304 | [email protected] "\n" | 303 | [email protected] "\n" |
305 | [email protected] "}" | 304 | [email protected] "}" |
306 | "# | 305 | "# |
307 | .trim() | 306 | .trim(), |
307 | syn.trim() | ||
308 | ); | 308 | ); |
309 | 309 | ||
310 | // With a raw string | 310 | // With a raw string |
@@ -320,7 +320,6 @@ fn bar() { | |||
320 | ); | 320 | ); |
321 | let syn = analysis.syntax_tree(range.file_id, Some(range.range)).unwrap(); | 321 | let syn = analysis.syntax_tree(range.file_id, Some(range.range)).unwrap(); |
322 | assert_eq_text!( | 322 | assert_eq_text!( |
323 | syn.trim(), | ||
324 | r#" | 323 | r#" |
325 | [email protected] | 324 | [email protected] |
326 | [email protected] | 325 | [email protected] |
@@ -351,7 +350,8 @@ [email protected] | |||
351 | [email protected] "\n" | 350 | [email protected] "\n" |
352 | [email protected] "}" | 351 | [email protected] "}" |
353 | "# | 352 | "# |
354 | .trim() | 353 | .trim(), |
354 | syn.trim() | ||
355 | ); | 355 | ); |
356 | } | 356 | } |
357 | } | 357 | } |
diff --git a/crates/ide_db/src/helpers/insert_use/tests.rs b/crates/ide_db/src/helpers/insert_use/tests.rs index a603fe87f..4bbe66f1f 100644 --- a/crates/ide_db/src/helpers/insert_use/tests.rs +++ b/crates/ide_db/src/helpers/insert_use/tests.rs | |||
@@ -599,7 +599,7 @@ fn check( | |||
599 | 599 | ||
600 | let rewriter = insert_use(&file, path, mb); | 600 | let rewriter = insert_use(&file, path, mb); |
601 | let result = rewriter.rewrite(file.as_syntax_node()).to_string(); | 601 | let result = rewriter.rewrite(file.as_syntax_node()).to_string(); |
602 | assert_eq_text!(&result, ra_fixture_after); | 602 | assert_eq_text!(ra_fixture_after, &result); |
603 | } | 603 | } |
604 | 604 | ||
605 | fn check_full(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) { | 605 | fn check_full(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) { |
diff --git a/crates/mbe/src/tests.rs b/crates/mbe/src/tests.rs index 9ff901e97..bd2977ebd 100644 --- a/crates/mbe/src/tests.rs +++ b/crates/mbe/src/tests.rs | |||
@@ -261,7 +261,6 @@ fn test_expr_order() { | |||
261 | 261 | ||
262 | let dump = format!("{:#?}", expanded); | 262 | let dump = format!("{:#?}", expanded); |
263 | assert_eq_text!( | 263 | assert_eq_text!( |
264 | dump.trim(), | ||
265 | r#"[email protected] | 264 | r#"[email protected] |
266 | [email protected] | 265 | [email protected] |
267 | [email protected] "fn" | 266 | [email protected] "fn" |
@@ -285,6 +284,7 @@ fn test_expr_order() { | |||
285 | [email protected] "2" | 284 | [email protected] "2" |
286 | [email protected] ";" | 285 | [email protected] ";" |
287 | [email protected] "}""#, | 286 | [email protected] "}""#, |
287 | dump.trim() | ||
288 | ); | 288 | ); |
289 | } | 289 | } |
290 | 290 | ||
@@ -989,7 +989,6 @@ fn test_tt_composite2() { | |||
989 | 989 | ||
990 | let res = format!("{:#?}", &node); | 990 | let res = format!("{:#?}", &node); |
991 | assert_eq_text!( | 991 | assert_eq_text!( |
992 | res.trim(), | ||
993 | r###"[email protected] | 992 | r###"[email protected] |
994 | [email protected] | 993 | [email protected] |
995 | [email protected] | 994 | [email protected] |
@@ -1003,7 +1002,8 @@ fn test_tt_composite2() { | |||
1003 | [email protected] ">" | 1002 | [email protected] ">" |
1004 | [email protected] " " | 1003 | [email protected] " " |
1005 | [email protected] "#" | 1004 | [email protected] "#" |
1006 | [email protected] ")""### | 1005 | [email protected] ")""###, |
1006 | res.trim() | ||
1007 | ); | 1007 | ); |
1008 | } | 1008 | } |
1009 | 1009 | ||
@@ -1742,7 +1742,7 @@ impl MacroFixture { | |||
1742 | fn assert_expand(&self, invocation: &str, expected: &str) { | 1742 | fn assert_expand(&self, invocation: &str, expected: &str) { |
1743 | let expansion = self.expand_tt(invocation); | 1743 | let expansion = self.expand_tt(invocation); |
1744 | let actual = format!("{:?}", expansion); | 1744 | let actual = format!("{:?}", expansion); |
1745 | test_utils::assert_eq_text!(&actual.trim(), &expected.trim()); | 1745 | test_utils::assert_eq_text!(&expected.trim(), &actual.trim()); |
1746 | } | 1746 | } |
1747 | 1747 | ||
1748 | fn assert_expand_items(&self, invocation: &str, expected: &str) -> &MacroFixture { | 1748 | fn assert_expand_items(&self, invocation: &str, expected: &str) -> &MacroFixture { |
@@ -1941,7 +1941,6 @@ fn test_no_space_after_semi_colon() { | |||
1941 | 1941 | ||
1942 | let dump = format!("{:#?}", expanded); | 1942 | let dump = format!("{:#?}", expanded); |
1943 | assert_eq_text!( | 1943 | assert_eq_text!( |
1944 | dump.trim(), | ||
1945 | r###"[email protected] | 1944 | r###"[email protected] |
1946 | [email protected] | 1945 | [email protected] |
1947 | [email protected] | 1946 | [email protected] |
@@ -1981,6 +1980,7 @@ fn test_no_space_after_semi_colon() { | |||
1981 | [email protected] | 1980 | [email protected] |
1982 | [email protected] "f" | 1981 | [email protected] "f" |
1983 | [email protected] ";""###, | 1982 | [email protected] ";""###, |
1983 | dump.trim() | ||
1984 | ); | 1984 | ); |
1985 | } | 1985 | } |
1986 | 1986 | ||
diff --git a/crates/proc_macro_srv/src/tests/mod.rs b/crates/proc_macro_srv/src/tests/mod.rs index 1a827cbd7..fd54f8dfd 100644 --- a/crates/proc_macro_srv/src/tests/mod.rs +++ b/crates/proc_macro_srv/src/tests/mod.rs | |||
@@ -38,9 +38,9 @@ fn test_derive_proc_macro_list() { | |||
38 | let res = list("serde_derive", "1").join("\n"); | 38 | let res = list("serde_derive", "1").join("\n"); |
39 | 39 | ||
40 | assert_eq_text!( | 40 | assert_eq_text!( |
41 | &res, | ||
42 | r#"Serialize [CustomDerive] | 41 | r#"Serialize [CustomDerive] |
43 | Deserialize [CustomDerive]"# | 42 | Deserialize [CustomDerive]"#, |
43 | &res | ||
44 | ); | 44 | ); |
45 | } | 45 | } |
46 | 46 | ||
@@ -50,9 +50,9 @@ fn list_test_macros() { | |||
50 | let res = list("proc_macro_test", "0.0.0").join("\n"); | 50 | let res = list("proc_macro_test", "0.0.0").join("\n"); |
51 | 51 | ||
52 | assert_eq_text!( | 52 | assert_eq_text!( |
53 | &res, | ||
54 | r#"function_like_macro [FuncLike] | 53 | r#"function_like_macro [FuncLike] |
55 | attribute_macro [Attr] | 54 | attribute_macro [Attr] |
56 | DummyTrait [CustomDerive]"# | 55 | DummyTrait [CustomDerive]"#, |
56 | &res | ||
57 | ); | 57 | ); |
58 | } | 58 | } |
diff --git a/crates/proc_macro_srv/src/tests/utils.rs b/crates/proc_macro_srv/src/tests/utils.rs index 36942147d..196abb8fc 100644 --- a/crates/proc_macro_srv/src/tests/utils.rs +++ b/crates/proc_macro_srv/src/tests/utils.rs | |||
@@ -52,7 +52,7 @@ pub fn assert_expand( | |||
52 | let fixture = parse_string(ra_fixture).unwrap(); | 52 | let fixture = parse_string(ra_fixture).unwrap(); |
53 | 53 | ||
54 | let res = expander.expand(macro_name, &fixture.subtree, None).unwrap(); | 54 | let res = expander.expand(macro_name, &fixture.subtree, None).unwrap(); |
55 | assert_eq_text!(&format!("{:?}", res), &expect.trim()); | 55 | assert_eq_text!(&expect.trim(), &format!("{:?}", res)); |
56 | } | 56 | } |
57 | 57 | ||
58 | pub fn list(crate_name: &str, version: &str) -> Vec<String> { | 58 | pub fn list(crate_name: &str, version: &str) -> Vec<String> { |