aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/handlers
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-03-23 21:23:26 +0000
committerKirill Bulatov <[email protected]>2020-03-24 08:43:24 +0000
commitdd3b64124b086cf68c3f8b1e838601b5770a9795 (patch)
treec9afbe6d9c1c40bea7dedc05dded93aa6c7c146b /crates/ra_assists/src/handlers
parent944f28fe5bf2b8e4316cc67bf5f824333fc4f180 (diff)
Add a test
Diffstat (limited to 'crates/ra_assists/src/handlers')
-rw-r--r--crates/ra_assists/src/handlers/auto_import.rs25
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)]
62struct AutoImportAssets { 63struct 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
470fn 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,