diff options
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/completion/complete_dot.rs | 37 | ||||
-rw-r--r-- | crates/ra_ide/src/expand_macro.rs | 2 |
2 files changed, 38 insertions, 1 deletions
diff --git a/crates/ra_ide/src/completion/complete_dot.rs b/crates/ra_ide/src/completion/complete_dot.rs index f07611d88..a30d1c2de 100644 --- a/crates/ra_ide/src/completion/complete_dot.rs +++ b/crates/ra_ide/src/completion/complete_dot.rs | |||
@@ -752,6 +752,43 @@ mod tests { | |||
752 | } | 752 | } |
753 | 753 | ||
754 | #[test] | 754 | #[test] |
755 | fn macro_expansion_resilient() { | ||
756 | assert_debug_snapshot!( | ||
757 | do_ref_completion( | ||
758 | r" | ||
759 | macro_rules! dbg { | ||
760 | () => {}; | ||
761 | ($val:expr) => { | ||
762 | match $val { tmp => { tmp } } | ||
763 | }; | ||
764 | // Trailing comma with single argument is ignored | ||
765 | ($val:expr,) => { $crate::dbg!($val) }; | ||
766 | ($($val:expr),+ $(,)?) => { | ||
767 | ($($crate::dbg!($val)),+,) | ||
768 | }; | ||
769 | } | ||
770 | struct A { the_field: u32 } | ||
771 | fn foo(a: A) { | ||
772 | dbg!(a.<|>) | ||
773 | } | ||
774 | ", | ||
775 | ), | ||
776 | @r###" | ||
777 | [ | ||
778 | CompletionItem { | ||
779 | label: "the_field", | ||
780 | source_range: [552; 553), | ||
781 | delete: [552; 553), | ||
782 | insert: "the_field", | ||
783 | kind: Field, | ||
784 | detail: "u32", | ||
785 | }, | ||
786 | ] | ||
787 | "### | ||
788 | ); | ||
789 | } | ||
790 | |||
791 | #[test] | ||
755 | fn test_method_completion_3547() { | 792 | fn test_method_completion_3547() { |
756 | assert_debug_snapshot!( | 793 | assert_debug_snapshot!( |
757 | do_ref_completion( | 794 | do_ref_completion( |
diff --git a/crates/ra_ide/src/expand_macro.rs b/crates/ra_ide/src/expand_macro.rs index f6667cb33..e58526f31 100644 --- a/crates/ra_ide/src/expand_macro.rs +++ b/crates/ra_ide/src/expand_macro.rs | |||
@@ -259,7 +259,7 @@ fn some_thing() -> u32 { | |||
259 | ); | 259 | ); |
260 | 260 | ||
261 | assert_eq!(res.name, "foo"); | 261 | assert_eq!(res.name, "foo"); |
262 | assert_snapshot!(res.expansion, @r###"bar!()"###); | 262 | assert_snapshot!(res.expansion, @r###""###); |
263 | } | 263 | } |
264 | 264 | ||
265 | #[test] | 265 | #[test] |