diff options
| -rw-r--r-- | crates/ra_assists/src/handlers/auto_import.rs | 31 |
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 | |||
| 914 | fn main() { | ||
| 915 | Cheese; | ||
| 916 | } | ||
| 917 | ", | ||
| 918 | ); | ||
| 919 | } | ||
| 889 | } | 920 | } |
