aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-06-10 10:39:06 +0100
committerJonas Schievink <[email protected]>2020-06-10 11:38:58 +0100
commit781b514e5886cbaff88483cdeddc504effef299c (patch)
tree08892039455a51afe2cf29de31a8fd32c9be2428 /crates
parenta70a0ca73ceac339de4e1df6d561894e485ba5ee (diff)
Add test for macro generated items
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/handlers/auto_import.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/crates/ra_assists/src/handlers/auto_import.rs b/crates/ra_assists/src/handlers/auto_import.rs
index 1f4142747..86a173ff5 100644
--- a/crates/ra_assists/src/handlers/auto_import.rs
+++ b/crates/ra_assists/src/handlers/auto_import.rs
@@ -865,6 +865,7 @@ fn main() {
865 865
866 #[test] 866 #[test]
867 fn whole_segment() { 867 fn whole_segment() {
868 // Tests that only imports whose last segment matches the identifier get suggested.
868 check_assist( 869 check_assist(
869 auto_import, 870 auto_import,
870 r" 871 r"
@@ -886,4 +887,34 @@ impl fmt::Display for S {}
886", 887",
887 ); 888 );
888 } 889 }
890
891 #[test]
892 fn macro_generated() {
893 // Tests that macro-generated items are suggested from external crates.
894 check_assist(
895 auto_import,
896 r"
897 //- /lib.rs crate:dep
898
899 macro_rules! mac {
900 () => {
901 pub struct Cheese;
902 };
903 }
904
905 mac!();
906
907 //- /main.rs crate:main deps:dep
908
909 fn main() {
910 Cheese<|>;
911 }",
912 r"use dep::Cheese;
913
914fn main() {
915 Cheese;
916}
917",
918 );
919 }
889} 920}