diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_ide/src/completion.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/diagnostics.rs | 42 | ||||
-rw-r--r-- | crates/ra_ide/src/goto_type_definition.rs | 14 | ||||
-rw-r--r-- | crates/ra_ide/src/hover.rs | 72 | ||||
-rw-r--r-- | crates/ra_proc_macro_srv/src/tests/mod.rs | 6 | ||||
-rw-r--r-- | crates/ra_proc_macro_srv/src/tests/utils.rs | 4 |
6 files changed, 71 insertions, 71 deletions
diff --git a/crates/ra_ide/src/completion.rs b/crates/ra_ide/src/completion.rs index e1fcf379d..69ea754b3 100644 --- a/crates/ra_ide/src/completion.rs +++ b/crates/ra_ide/src/completion.rs | |||
@@ -137,8 +137,8 @@ mod tests { | |||
137 | documentation: &'a str, | 137 | documentation: &'a str, |
138 | } | 138 | } |
139 | 139 | ||
140 | fn check_detail_and_documentation(fixture: &str, expected: DetailAndDocumentation) { | 140 | fn check_detail_and_documentation(ra_fixture: &str, expected: DetailAndDocumentation) { |
141 | let (analysis, position) = analysis_and_position(fixture); | 141 | let (analysis, position) = analysis_and_position(ra_fixture); |
142 | let config = CompletionConfig::default(); | 142 | let config = CompletionConfig::default(); |
143 | let completions = analysis.completions(&config, position).unwrap().unwrap(); | 143 | let completions = analysis.completions(&config, position).unwrap().unwrap(); |
144 | for item in completions { | 144 | for item in completions { |
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index 05fb799d6..46f8c31c7 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs | |||
@@ -324,10 +324,10 @@ mod tests { | |||
324 | /// * a diagnostic is produced | 324 | /// * a diagnostic is produced |
325 | /// * this diagnostic touches the input cursor position | 325 | /// * this diagnostic touches the input cursor position |
326 | /// * that the contents of the file containing the cursor match `after` after the diagnostic fix is applied | 326 | /// * that the contents of the file containing the cursor match `after` after the diagnostic fix is applied |
327 | fn check_apply_diagnostic_fix_from_position(fixture: &str, after: &str) { | 327 | fn check_apply_diagnostic_fix_from_position(ra_fixture: &str, after: &str) { |
328 | let after = trim_indent(after); | 328 | let after = trim_indent(after); |
329 | 329 | ||
330 | let (analysis, file_position) = analysis_and_position(fixture); | 330 | let (analysis, file_position) = analysis_and_position(ra_fixture); |
331 | let diagnostic = analysis.diagnostics(file_position.file_id).unwrap().pop().unwrap(); | 331 | let diagnostic = analysis.diagnostics(file_position.file_id).unwrap().pop().unwrap(); |
332 | let mut fix = diagnostic.fix.unwrap(); | 332 | let mut fix = diagnostic.fix.unwrap(); |
333 | let edit = fix.source_change.source_file_edits.pop().unwrap().edit; | 333 | let edit = fix.source_change.source_file_edits.pop().unwrap().edit; |
@@ -365,14 +365,14 @@ mod tests { | |||
365 | 365 | ||
366 | /// Takes a multi-file input fixture with annotated cursor position and checks that no diagnostics | 366 | /// Takes a multi-file input fixture with annotated cursor position and checks that no diagnostics |
367 | /// apply to the file containing the cursor. | 367 | /// apply to the file containing the cursor. |
368 | fn check_no_diagnostic_for_target_file(fixture: &str) { | 368 | fn check_no_diagnostic_for_target_file(ra_fixture: &str) { |
369 | let (analysis, file_position) = analysis_and_position(fixture); | 369 | let (analysis, file_position) = analysis_and_position(ra_fixture); |
370 | let diagnostics = analysis.diagnostics(file_position.file_id).unwrap(); | 370 | let diagnostics = analysis.diagnostics(file_position.file_id).unwrap(); |
371 | assert_eq!(diagnostics.len(), 0); | 371 | assert_eq!(diagnostics.len(), 0); |
372 | } | 372 | } |
373 | 373 | ||
374 | fn check_no_diagnostic(content: &str) { | 374 | fn check_no_diagnostic(ra_fixture: &str) { |
375 | let (analysis, file_id) = single_file(content); | 375 | let (analysis, file_id) = single_file(ra_fixture); |
376 | let diagnostics = analysis.diagnostics(file_id).unwrap(); | 376 | let diagnostics = analysis.diagnostics(file_id).unwrap(); |
377 | assert_eq!(diagnostics.len(), 0, "expected no diagnostic, found one"); | 377 | assert_eq!(diagnostics.len(), 0, "expected no diagnostic, found one"); |
378 | } | 378 | } |
@@ -473,7 +473,8 @@ mod tests { | |||
473 | 473 | ||
474 | #[test] | 474 | #[test] |
475 | fn test_wrap_return_type_not_applicable_when_expr_type_does_not_match_ok_type() { | 475 | fn test_wrap_return_type_not_applicable_when_expr_type_does_not_match_ok_type() { |
476 | let content = r#" | 476 | check_no_diagnostic_for_target_file( |
477 | r" | ||
477 | //- /main.rs | 478 | //- /main.rs |
478 | use core::result::Result::{self, Ok, Err}; | 479 | use core::result::Result::{self, Ok, Err}; |
479 | 480 | ||
@@ -485,13 +486,14 @@ mod tests { | |||
485 | pub mod result { | 486 | pub mod result { |
486 | pub enum Result<T, E> { Ok(T), Err(E) } | 487 | pub enum Result<T, E> { Ok(T), Err(E) } |
487 | } | 488 | } |
488 | "#; | 489 | ", |
489 | check_no_diagnostic_for_target_file(content); | 490 | ); |
490 | } | 491 | } |
491 | 492 | ||
492 | #[test] | 493 | #[test] |
493 | fn test_wrap_return_type_not_applicable_when_return_type_is_not_result() { | 494 | fn test_wrap_return_type_not_applicable_when_return_type_is_not_result() { |
494 | let content = r#" | 495 | check_no_diagnostic_for_target_file( |
496 | r" | ||
495 | //- /main.rs | 497 | //- /main.rs |
496 | use core::result::Result::{self, Ok, Err}; | 498 | use core::result::Result::{self, Ok, Err}; |
497 | 499 | ||
@@ -508,8 +510,8 @@ mod tests { | |||
508 | pub mod result { | 510 | pub mod result { |
509 | pub enum Result<T, E> { Ok(T), Err(E) } | 511 | pub enum Result<T, E> { Ok(T), Err(E) } |
510 | } | 512 | } |
511 | "#; | 513 | ", |
512 | check_no_diagnostic_for_target_file(content); | 514 | ); |
513 | } | 515 | } |
514 | 516 | ||
515 | #[test] | 517 | #[test] |
@@ -618,7 +620,8 @@ mod tests { | |||
618 | 620 | ||
619 | #[test] | 621 | #[test] |
620 | fn test_fill_struct_fields_no_diagnostic() { | 622 | fn test_fill_struct_fields_no_diagnostic() { |
621 | let content = r" | 623 | check_no_diagnostic( |
624 | r" | ||
622 | struct TestStruct { | 625 | struct TestStruct { |
623 | one: i32, | 626 | one: i32, |
624 | two: i64, | 627 | two: i64, |
@@ -628,14 +631,14 @@ mod tests { | |||
628 | let one = 1; | 631 | let one = 1; |
629 | let s = TestStruct{ one, two: 2 }; | 632 | let s = TestStruct{ one, two: 2 }; |
630 | } | 633 | } |
631 | "; | 634 | ", |
632 | 635 | ); | |
633 | check_no_diagnostic(content); | ||
634 | } | 636 | } |
635 | 637 | ||
636 | #[test] | 638 | #[test] |
637 | fn test_fill_struct_fields_no_diagnostic_on_spread() { | 639 | fn test_fill_struct_fields_no_diagnostic_on_spread() { |
638 | let content = r" | 640 | check_no_diagnostic( |
641 | r" | ||
639 | struct TestStruct { | 642 | struct TestStruct { |
640 | one: i32, | 643 | one: i32, |
641 | two: i64, | 644 | two: i64, |
@@ -645,9 +648,8 @@ mod tests { | |||
645 | let one = 1; | 648 | let one = 1; |
646 | let s = TestStruct{ ..a }; | 649 | let s = TestStruct{ ..a }; |
647 | } | 650 | } |
648 | "; | 651 | ", |
649 | 652 | ); | |
650 | check_no_diagnostic(content); | ||
651 | } | 653 | } |
652 | 654 | ||
653 | #[test] | 655 | #[test] |
diff --git a/crates/ra_ide/src/goto_type_definition.rs b/crates/ra_ide/src/goto_type_definition.rs index 91a3097fb..7eb40d637 100644 --- a/crates/ra_ide/src/goto_type_definition.rs +++ b/crates/ra_ide/src/goto_type_definition.rs | |||
@@ -55,8 +55,8 @@ fn pick_best(tokens: TokenAtOffset<SyntaxToken>) -> Option<SyntaxToken> { | |||
55 | mod tests { | 55 | mod tests { |
56 | use crate::mock_analysis::analysis_and_position; | 56 | use crate::mock_analysis::analysis_and_position; |
57 | 57 | ||
58 | fn check_goto(fixture: &str, expected: &str) { | 58 | fn check_goto(ra_fixture: &str, expected: &str) { |
59 | let (analysis, pos) = analysis_and_position(fixture); | 59 | let (analysis, pos) = analysis_and_position(ra_fixture); |
60 | 60 | ||
61 | let mut navs = analysis.goto_type_definition(pos).unwrap().unwrap().info; | 61 | let mut navs = analysis.goto_type_definition(pos).unwrap().unwrap().info; |
62 | assert_eq!(navs.len(), 1); | 62 | assert_eq!(navs.len(), 1); |
@@ -67,7 +67,7 @@ mod tests { | |||
67 | #[test] | 67 | #[test] |
68 | fn goto_type_definition_works_simple() { | 68 | fn goto_type_definition_works_simple() { |
69 | check_goto( | 69 | check_goto( |
70 | " | 70 | r" |
71 | //- /lib.rs | 71 | //- /lib.rs |
72 | struct Foo; | 72 | struct Foo; |
73 | fn foo() { | 73 | fn foo() { |
@@ -82,7 +82,7 @@ mod tests { | |||
82 | #[test] | 82 | #[test] |
83 | fn goto_type_definition_works_simple_ref() { | 83 | fn goto_type_definition_works_simple_ref() { |
84 | check_goto( | 84 | check_goto( |
85 | " | 85 | r" |
86 | //- /lib.rs | 86 | //- /lib.rs |
87 | struct Foo; | 87 | struct Foo; |
88 | fn foo() { | 88 | fn foo() { |
@@ -97,7 +97,7 @@ mod tests { | |||
97 | #[test] | 97 | #[test] |
98 | fn goto_type_definition_works_through_macro() { | 98 | fn goto_type_definition_works_through_macro() { |
99 | check_goto( | 99 | check_goto( |
100 | " | 100 | r" |
101 | //- /lib.rs | 101 | //- /lib.rs |
102 | macro_rules! id { | 102 | macro_rules! id { |
103 | ($($tt:tt)*) => { $($tt)* } | 103 | ($($tt:tt)*) => { $($tt)* } |
@@ -116,7 +116,7 @@ mod tests { | |||
116 | #[test] | 116 | #[test] |
117 | fn goto_type_definition_for_param() { | 117 | fn goto_type_definition_for_param() { |
118 | check_goto( | 118 | check_goto( |
119 | " | 119 | r" |
120 | //- /lib.rs | 120 | //- /lib.rs |
121 | struct Foo; | 121 | struct Foo; |
122 | fn foo(<|>f: Foo) {} | 122 | fn foo(<|>f: Foo) {} |
@@ -128,7 +128,7 @@ mod tests { | |||
128 | #[test] | 128 | #[test] |
129 | fn goto_type_definition_for_tuple_field() { | 129 | fn goto_type_definition_for_tuple_field() { |
130 | check_goto( | 130 | check_goto( |
131 | " | 131 | r" |
132 | //- /lib.rs | 132 | //- /lib.rs |
133 | struct Foo; | 133 | struct Foo; |
134 | struct Bar(Foo); | 134 | struct Bar(Foo); |
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index c3e36a387..eaba2b61e 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs | |||
@@ -417,8 +417,8 @@ mod tests { | |||
417 | assert_eq!(offset, position.into()); | 417 | assert_eq!(offset, position.into()); |
418 | } | 418 | } |
419 | 419 | ||
420 | fn check_hover_result(fixture: &str, expected: &[&str]) -> (String, Vec<HoverAction>) { | 420 | fn check_hover_result(ra_fixture: &str, expected: &[&str]) -> (String, Vec<HoverAction>) { |
421 | let (analysis, position) = analysis_and_position(fixture); | 421 | let (analysis, position) = analysis_and_position(ra_fixture); |
422 | let hover = analysis.hover(position).unwrap().unwrap(); | 422 | let hover = analysis.hover(position).unwrap().unwrap(); |
423 | let mut results = Vec::from(hover.info.results()); | 423 | let mut results = Vec::from(hover.info.results()); |
424 | results.sort(); | 424 | results.sort(); |
@@ -435,8 +435,8 @@ mod tests { | |||
435 | (content[hover.range].to_string(), hover.info.actions().to_vec()) | 435 | (content[hover.range].to_string(), hover.info.actions().to_vec()) |
436 | } | 436 | } |
437 | 437 | ||
438 | fn check_hover_no_result(fixture: &str) { | 438 | fn check_hover_no_result(ra_fixture: &str) { |
439 | let (analysis, position) = analysis_and_position(fixture); | 439 | let (analysis, position) = analysis_and_position(ra_fixture); |
440 | assert!(analysis.hover(position).unwrap().is_none()); | 440 | assert!(analysis.hover(position).unwrap().is_none()); |
441 | } | 441 | } |
442 | 442 | ||
@@ -923,7 +923,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
923 | #[test] | 923 | #[test] |
924 | fn test_hover_through_macro() { | 924 | fn test_hover_through_macro() { |
925 | let (hover_on, _) = check_hover_result( | 925 | let (hover_on, _) = check_hover_result( |
926 | " | 926 | r" |
927 | //- /lib.rs | 927 | //- /lib.rs |
928 | macro_rules! id { | 928 | macro_rules! id { |
929 | ($($tt:tt)*) => { $($tt)* } | 929 | ($($tt:tt)*) => { $($tt)* } |
@@ -944,7 +944,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
944 | #[test] | 944 | #[test] |
945 | fn test_hover_through_expr_in_macro() { | 945 | fn test_hover_through_expr_in_macro() { |
946 | let (hover_on, _) = check_hover_result( | 946 | let (hover_on, _) = check_hover_result( |
947 | " | 947 | r" |
948 | //- /lib.rs | 948 | //- /lib.rs |
949 | macro_rules! id { | 949 | macro_rules! id { |
950 | ($($tt:tt)*) => { $($tt)* } | 950 | ($($tt:tt)*) => { $($tt)* } |
@@ -962,7 +962,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
962 | #[test] | 962 | #[test] |
963 | fn test_hover_through_expr_in_macro_recursive() { | 963 | fn test_hover_through_expr_in_macro_recursive() { |
964 | let (hover_on, _) = check_hover_result( | 964 | let (hover_on, _) = check_hover_result( |
965 | " | 965 | r" |
966 | //- /lib.rs | 966 | //- /lib.rs |
967 | macro_rules! id_deep { | 967 | macro_rules! id_deep { |
968 | ($($tt:tt)*) => { $($tt)* } | 968 | ($($tt:tt)*) => { $($tt)* } |
@@ -983,7 +983,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
983 | #[test] | 983 | #[test] |
984 | fn test_hover_through_func_in_macro_recursive() { | 984 | fn test_hover_through_func_in_macro_recursive() { |
985 | let (hover_on, _) = check_hover_result( | 985 | let (hover_on, _) = check_hover_result( |
986 | " | 986 | r" |
987 | //- /lib.rs | 987 | //- /lib.rs |
988 | macro_rules! id_deep { | 988 | macro_rules! id_deep { |
989 | ($($tt:tt)*) => { $($tt)* } | 989 | ($($tt:tt)*) => { $($tt)* } |
@@ -1026,7 +1026,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1026 | #[test] | 1026 | #[test] |
1027 | fn test_hover_through_assert_macro() { | 1027 | fn test_hover_through_assert_macro() { |
1028 | let (hover_on, _) = check_hover_result( | 1028 | let (hover_on, _) = check_hover_result( |
1029 | r#" | 1029 | r" |
1030 | //- /lib.rs | 1030 | //- /lib.rs |
1031 | #[rustc_builtin_macro] | 1031 | #[rustc_builtin_macro] |
1032 | macro_rules! assert {} | 1032 | macro_rules! assert {} |
@@ -1035,7 +1035,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1035 | fn foo() { | 1035 | fn foo() { |
1036 | assert!(ba<|>r()); | 1036 | assert!(ba<|>r()); |
1037 | } | 1037 | } |
1038 | "#, | 1038 | ", |
1039 | &["fn bar() -> bool"], | 1039 | &["fn bar() -> bool"], |
1040 | ); | 1040 | ); |
1041 | 1041 | ||
@@ -1077,14 +1077,14 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1077 | #[test] | 1077 | #[test] |
1078 | fn test_hover_function_show_qualifiers() { | 1078 | fn test_hover_function_show_qualifiers() { |
1079 | check_hover_result( | 1079 | check_hover_result( |
1080 | " | 1080 | r" |
1081 | //- /lib.rs | 1081 | //- /lib.rs |
1082 | async fn foo<|>() {} | 1082 | async fn foo<|>() {} |
1083 | ", | 1083 | ", |
1084 | &["async fn foo()"], | 1084 | &["async fn foo()"], |
1085 | ); | 1085 | ); |
1086 | check_hover_result( | 1086 | check_hover_result( |
1087 | " | 1087 | r" |
1088 | //- /lib.rs | 1088 | //- /lib.rs |
1089 | pub const unsafe fn foo<|>() {} | 1089 | pub const unsafe fn foo<|>() {} |
1090 | ", | 1090 | ", |
@@ -1102,7 +1102,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1102 | #[test] | 1102 | #[test] |
1103 | fn test_hover_trait_show_qualifiers() { | 1103 | fn test_hover_trait_show_qualifiers() { |
1104 | let (_, actions) = check_hover_result( | 1104 | let (_, actions) = check_hover_result( |
1105 | " | 1105 | r" |
1106 | //- /lib.rs | 1106 | //- /lib.rs |
1107 | unsafe trait foo<|>() {} | 1107 | unsafe trait foo<|>() {} |
1108 | ", | 1108 | ", |
@@ -1114,7 +1114,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1114 | #[test] | 1114 | #[test] |
1115 | fn test_hover_mod_with_same_name_as_function() { | 1115 | fn test_hover_mod_with_same_name_as_function() { |
1116 | check_hover_result( | 1116 | check_hover_result( |
1117 | " | 1117 | r" |
1118 | //- /lib.rs | 1118 | //- /lib.rs |
1119 | use self::m<|>y::Bar; | 1119 | use self::m<|>y::Bar; |
1120 | 1120 | ||
@@ -1237,7 +1237,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1237 | #[test] | 1237 | #[test] |
1238 | fn test_hover_trait_has_impl_action() { | 1238 | fn test_hover_trait_has_impl_action() { |
1239 | let (_, actions) = check_hover_result( | 1239 | let (_, actions) = check_hover_result( |
1240 | " | 1240 | r" |
1241 | //- /lib.rs | 1241 | //- /lib.rs |
1242 | trait foo<|>() {} | 1242 | trait foo<|>() {} |
1243 | ", | 1243 | ", |
@@ -1249,7 +1249,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1249 | #[test] | 1249 | #[test] |
1250 | fn test_hover_struct_has_impl_action() { | 1250 | fn test_hover_struct_has_impl_action() { |
1251 | let (_, actions) = check_hover_result( | 1251 | let (_, actions) = check_hover_result( |
1252 | " | 1252 | r" |
1253 | //- /lib.rs | 1253 | //- /lib.rs |
1254 | struct foo<|>() {} | 1254 | struct foo<|>() {} |
1255 | ", | 1255 | ", |
@@ -1261,7 +1261,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1261 | #[test] | 1261 | #[test] |
1262 | fn test_hover_union_has_impl_action() { | 1262 | fn test_hover_union_has_impl_action() { |
1263 | let (_, actions) = check_hover_result( | 1263 | let (_, actions) = check_hover_result( |
1264 | " | 1264 | r" |
1265 | //- /lib.rs | 1265 | //- /lib.rs |
1266 | union foo<|>() {} | 1266 | union foo<|>() {} |
1267 | ", | 1267 | ", |
@@ -1273,7 +1273,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1273 | #[test] | 1273 | #[test] |
1274 | fn test_hover_enum_has_impl_action() { | 1274 | fn test_hover_enum_has_impl_action() { |
1275 | let (_, actions) = check_hover_result( | 1275 | let (_, actions) = check_hover_result( |
1276 | " | 1276 | r" |
1277 | //- /lib.rs | 1277 | //- /lib.rs |
1278 | enum foo<|>() { | 1278 | enum foo<|>() { |
1279 | A, | 1279 | A, |
@@ -1288,7 +1288,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1288 | #[test] | 1288 | #[test] |
1289 | fn test_hover_test_has_action() { | 1289 | fn test_hover_test_has_action() { |
1290 | let (_, actions) = check_hover_result( | 1290 | let (_, actions) = check_hover_result( |
1291 | " | 1291 | r" |
1292 | //- /lib.rs | 1292 | //- /lib.rs |
1293 | #[test] | 1293 | #[test] |
1294 | fn foo_<|>test() {} | 1294 | fn foo_<|>test() {} |
@@ -1332,7 +1332,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1332 | #[test] | 1332 | #[test] |
1333 | fn test_hover_test_mod_has_action() { | 1333 | fn test_hover_test_mod_has_action() { |
1334 | let (_, actions) = check_hover_result( | 1334 | let (_, actions) = check_hover_result( |
1335 | " | 1335 | r" |
1336 | //- /lib.rs | 1336 | //- /lib.rs |
1337 | mod tests<|> { | 1337 | mod tests<|> { |
1338 | #[test] | 1338 | #[test] |
@@ -1373,7 +1373,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1373 | #[test] | 1373 | #[test] |
1374 | fn test_hover_struct_has_goto_type_action() { | 1374 | fn test_hover_struct_has_goto_type_action() { |
1375 | let (_, actions) = check_hover_result( | 1375 | let (_, actions) = check_hover_result( |
1376 | " | 1376 | r" |
1377 | //- /main.rs | 1377 | //- /main.rs |
1378 | struct S{ f1: u32 } | 1378 | struct S{ f1: u32 } |
1379 | 1379 | ||
@@ -1416,7 +1416,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1416 | #[test] | 1416 | #[test] |
1417 | fn test_hover_generic_struct_has_goto_type_actions() { | 1417 | fn test_hover_generic_struct_has_goto_type_actions() { |
1418 | let (_, actions) = check_hover_result( | 1418 | let (_, actions) = check_hover_result( |
1419 | " | 1419 | r" |
1420 | //- /main.rs | 1420 | //- /main.rs |
1421 | struct Arg(u32); | 1421 | struct Arg(u32); |
1422 | struct S<T>{ f1: T } | 1422 | struct S<T>{ f1: T } |
@@ -1479,7 +1479,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1479 | #[test] | 1479 | #[test] |
1480 | fn test_hover_generic_struct_has_flattened_goto_type_actions() { | 1480 | fn test_hover_generic_struct_has_flattened_goto_type_actions() { |
1481 | let (_, actions) = check_hover_result( | 1481 | let (_, actions) = check_hover_result( |
1482 | " | 1482 | r" |
1483 | //- /main.rs | 1483 | //- /main.rs |
1484 | struct Arg(u32); | 1484 | struct Arg(u32); |
1485 | struct S<T>{ f1: T } | 1485 | struct S<T>{ f1: T } |
@@ -1542,7 +1542,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1542 | #[test] | 1542 | #[test] |
1543 | fn test_hover_tuple_has_goto_type_actions() { | 1543 | fn test_hover_tuple_has_goto_type_actions() { |
1544 | let (_, actions) = check_hover_result( | 1544 | let (_, actions) = check_hover_result( |
1545 | " | 1545 | r" |
1546 | //- /main.rs | 1546 | //- /main.rs |
1547 | struct A(u32); | 1547 | struct A(u32); |
1548 | struct B(u32); | 1548 | struct B(u32); |
@@ -1627,7 +1627,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1627 | #[test] | 1627 | #[test] |
1628 | fn test_hover_return_impl_trait_has_goto_type_action() { | 1628 | fn test_hover_return_impl_trait_has_goto_type_action() { |
1629 | let (_, actions) = check_hover_result( | 1629 | let (_, actions) = check_hover_result( |
1630 | " | 1630 | r" |
1631 | //- /main.rs | 1631 | //- /main.rs |
1632 | trait Foo {} | 1632 | trait Foo {} |
1633 | 1633 | ||
@@ -1672,7 +1672,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1672 | #[test] | 1672 | #[test] |
1673 | fn test_hover_generic_return_impl_trait_has_goto_type_action() { | 1673 | fn test_hover_generic_return_impl_trait_has_goto_type_action() { |
1674 | let (_, actions) = check_hover_result( | 1674 | let (_, actions) = check_hover_result( |
1675 | " | 1675 | r" |
1676 | //- /main.rs | 1676 | //- /main.rs |
1677 | trait Foo<T> {} | 1677 | trait Foo<T> {} |
1678 | struct S; | 1678 | struct S; |
@@ -1737,7 +1737,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1737 | #[test] | 1737 | #[test] |
1738 | fn test_hover_return_impl_traits_has_goto_type_action() { | 1738 | fn test_hover_return_impl_traits_has_goto_type_action() { |
1739 | let (_, actions) = check_hover_result( | 1739 | let (_, actions) = check_hover_result( |
1740 | " | 1740 | r" |
1741 | //- /main.rs | 1741 | //- /main.rs |
1742 | trait Foo {} | 1742 | trait Foo {} |
1743 | trait Bar {} | 1743 | trait Bar {} |
@@ -1802,7 +1802,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1802 | #[test] | 1802 | #[test] |
1803 | fn test_hover_generic_return_impl_traits_has_goto_type_action() { | 1803 | fn test_hover_generic_return_impl_traits_has_goto_type_action() { |
1804 | let (_, actions) = check_hover_result( | 1804 | let (_, actions) = check_hover_result( |
1805 | " | 1805 | r" |
1806 | //- /main.rs | 1806 | //- /main.rs |
1807 | trait Foo<T> {} | 1807 | trait Foo<T> {} |
1808 | trait Bar<T> {} | 1808 | trait Bar<T> {} |
@@ -1907,7 +1907,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1907 | #[test] | 1907 | #[test] |
1908 | fn test_hover_arg_impl_trait_has_goto_type_action() { | 1908 | fn test_hover_arg_impl_trait_has_goto_type_action() { |
1909 | let (_, actions) = check_hover_result( | 1909 | let (_, actions) = check_hover_result( |
1910 | " | 1910 | r" |
1911 | //- /lib.rs | 1911 | //- /lib.rs |
1912 | trait Foo {} | 1912 | trait Foo {} |
1913 | fn foo(ar<|>g: &impl Foo) {} | 1913 | fn foo(ar<|>g: &impl Foo) {} |
@@ -1947,7 +1947,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1947 | #[test] | 1947 | #[test] |
1948 | fn test_hover_arg_impl_traits_has_goto_type_action() { | 1948 | fn test_hover_arg_impl_traits_has_goto_type_action() { |
1949 | let (_, actions) = check_hover_result( | 1949 | let (_, actions) = check_hover_result( |
1950 | " | 1950 | r" |
1951 | //- /lib.rs | 1951 | //- /lib.rs |
1952 | trait Foo {} | 1952 | trait Foo {} |
1953 | trait Bar<T> {} | 1953 | trait Bar<T> {} |
@@ -2028,7 +2028,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
2028 | #[test] | 2028 | #[test] |
2029 | fn test_hover_arg_generic_impl_trait_has_goto_type_action() { | 2029 | fn test_hover_arg_generic_impl_trait_has_goto_type_action() { |
2030 | let (_, actions) = check_hover_result( | 2030 | let (_, actions) = check_hover_result( |
2031 | " | 2031 | r" |
2032 | //- /lib.rs | 2032 | //- /lib.rs |
2033 | trait Foo<T> {} | 2033 | trait Foo<T> {} |
2034 | struct S {} | 2034 | struct S {} |
@@ -2088,7 +2088,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
2088 | #[test] | 2088 | #[test] |
2089 | fn test_hover_dyn_return_has_goto_type_action() { | 2089 | fn test_hover_dyn_return_has_goto_type_action() { |
2090 | let (_, actions) = check_hover_result( | 2090 | let (_, actions) = check_hover_result( |
2091 | " | 2091 | r" |
2092 | //- /main.rs | 2092 | //- /main.rs |
2093 | trait Foo {} | 2093 | trait Foo {} |
2094 | struct S; | 2094 | struct S; |
@@ -2156,7 +2156,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
2156 | #[test] | 2156 | #[test] |
2157 | fn test_hover_dyn_arg_has_goto_type_action() { | 2157 | fn test_hover_dyn_arg_has_goto_type_action() { |
2158 | let (_, actions) = check_hover_result( | 2158 | let (_, actions) = check_hover_result( |
2159 | " | 2159 | r" |
2160 | //- /lib.rs | 2160 | //- /lib.rs |
2161 | trait Foo {} | 2161 | trait Foo {} |
2162 | fn foo(ar<|>g: &dyn Foo) {} | 2162 | fn foo(ar<|>g: &dyn Foo) {} |
@@ -2196,7 +2196,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
2196 | #[test] | 2196 | #[test] |
2197 | fn test_hover_generic_dyn_arg_has_goto_type_action() { | 2197 | fn test_hover_generic_dyn_arg_has_goto_type_action() { |
2198 | let (_, actions) = check_hover_result( | 2198 | let (_, actions) = check_hover_result( |
2199 | " | 2199 | r" |
2200 | //- /lib.rs | 2200 | //- /lib.rs |
2201 | trait Foo<T> {} | 2201 | trait Foo<T> {} |
2202 | struct S {} | 2202 | struct S {} |
@@ -2256,7 +2256,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
2256 | #[test] | 2256 | #[test] |
2257 | fn test_hover_goto_type_action_links_order() { | 2257 | fn test_hover_goto_type_action_links_order() { |
2258 | let (_, actions) = check_hover_result( | 2258 | let (_, actions) = check_hover_result( |
2259 | " | 2259 | r" |
2260 | //- /lib.rs | 2260 | //- /lib.rs |
2261 | trait ImplTrait<T> {} | 2261 | trait ImplTrait<T> {} |
2262 | trait DynTrait<T> {} | 2262 | trait DynTrait<T> {} |
@@ -2357,7 +2357,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
2357 | #[test] | 2357 | #[test] |
2358 | fn test_hover_associated_type_has_goto_type_action() { | 2358 | fn test_hover_associated_type_has_goto_type_action() { |
2359 | let (_, actions) = check_hover_result( | 2359 | let (_, actions) = check_hover_result( |
2360 | " | 2360 | r" |
2361 | //- /main.rs | 2361 | //- /main.rs |
2362 | trait Foo { | 2362 | trait Foo { |
2363 | type Item; | 2363 | type Item; |
diff --git a/crates/ra_proc_macro_srv/src/tests/mod.rs b/crates/ra_proc_macro_srv/src/tests/mod.rs index 82cefbb29..8e6f28abd 100644 --- a/crates/ra_proc_macro_srv/src/tests/mod.rs +++ b/crates/ra_proc_macro_srv/src/tests/mod.rs | |||
@@ -11,7 +11,7 @@ fn test_derive_serialize_proc_macro() { | |||
11 | "serde_derive", | 11 | "serde_derive", |
12 | "Serialize", | 12 | "Serialize", |
13 | "1.0", | 13 | "1.0", |
14 | r##"struct Foo {}"##, | 14 | r"struct Foo {}", |
15 | include_str!("fixtures/test_serialize_proc_macro.txt"), | 15 | include_str!("fixtures/test_serialize_proc_macro.txt"), |
16 | ); | 16 | ); |
17 | } | 17 | } |
@@ -22,9 +22,7 @@ fn test_derive_serialize_proc_macro_failed() { | |||
22 | "serde_derive", | 22 | "serde_derive", |
23 | "Serialize", | 23 | "Serialize", |
24 | "1.0", | 24 | "1.0", |
25 | r##" | 25 | r"struct {}", |
26 | struct {} | ||
27 | "##, | ||
28 | r##" | 26 | r##" |
29 | SUBTREE $ | 27 | SUBTREE $ |
30 | IDENT compile_error 4294967295 | 28 | IDENT compile_error 4294967295 |
diff --git a/crates/ra_proc_macro_srv/src/tests/utils.rs b/crates/ra_proc_macro_srv/src/tests/utils.rs index 8d85f2d8a..dcb00671f 100644 --- a/crates/ra_proc_macro_srv/src/tests/utils.rs +++ b/crates/ra_proc_macro_srv/src/tests/utils.rs | |||
@@ -44,12 +44,12 @@ pub fn assert_expand( | |||
44 | crate_name: &str, | 44 | crate_name: &str, |
45 | macro_name: &str, | 45 | macro_name: &str, |
46 | version: &str, | 46 | version: &str, |
47 | fixture: &str, | 47 | ra_fixture: &str, |
48 | expect: &str, | 48 | expect: &str, |
49 | ) { | 49 | ) { |
50 | let path = fixtures::dylib_path(crate_name, version); | 50 | let path = fixtures::dylib_path(crate_name, version); |
51 | let expander = dylib::Expander::new(&path).unwrap(); | 51 | let expander = dylib::Expander::new(&path).unwrap(); |
52 | let fixture = parse_string(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!(&format!("{:?}", res), &expect.trim()); |