diff options
author | Kirill Bulatov <[email protected]> | 2020-03-23 21:23:26 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-03-24 08:43:24 +0000 |
commit | dd3b64124b086cf68c3f8b1e838601b5770a9795 (patch) | |
tree | c9afbe6d9c1c40bea7dedc05dded93aa6c7c146b /crates/ra_assists/src/handlers | |
parent | 944f28fe5bf2b8e4316cc67bf5f824333fc4f180 (diff) |
Add a test
Diffstat (limited to 'crates/ra_assists/src/handlers')
-rw-r--r-- | crates/ra_assists/src/handlers/auto_import.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crates/ra_assists/src/handlers/auto_import.rs b/crates/ra_assists/src/handlers/auto_import.rs index 443eeaaf0..99682e023 100644 --- a/crates/ra_assists/src/handlers/auto_import.rs +++ b/crates/ra_assists/src/handlers/auto_import.rs | |||
@@ -59,6 +59,7 @@ pub(crate) fn auto_import(ctx: AssistCtx) -> Option<Assist> { | |||
59 | group.finish() | 59 | group.finish() |
60 | } | 60 | } |
61 | 61 | ||
62 | #[derive(Debug)] | ||
62 | struct AutoImportAssets { | 63 | struct AutoImportAssets { |
63 | import_candidate: ImportCandidate, | 64 | import_candidate: ImportCandidate, |
64 | module_with_name_to_import: Module, | 65 | module_with_name_to_import: Module, |
@@ -450,6 +451,30 @@ mod tests { | |||
450 | } | 451 | } |
451 | 452 | ||
452 | #[test] | 453 | #[test] |
454 | fn macro_import() { | ||
455 | check_assist( | ||
456 | auto_import, | ||
457 | r" | ||
458 | //- /lib.rs crate:crate_with_macro | ||
459 | #[macro_export] | ||
460 | macro_rules! foo { | ||
461 | () => () | ||
462 | } | ||
463 | |||
464 | //- /main.rs crate:main deps:crate_with_macro | ||
465 | fn main() { | ||
466 | foo<|> | ||
467 | }", | ||
468 | r"use crate_with_macro::foo; | ||
469 | |||
470 | fn main() { | ||
471 | foo<|> | ||
472 | } | ||
473 | ", | ||
474 | ); | ||
475 | } | ||
476 | |||
477 | #[test] | ||
453 | fn auto_import_target() { | 478 | fn auto_import_target() { |
454 | check_assist_target( | 479 | check_assist_target( |
455 | auto_import, | 480 | auto_import, |