From dd3b64124b086cf68c3f8b1e838601b5770a9795 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 23 Mar 2020 23:23:26 +0200 Subject: Add a test --- crates/ra_assists/src/handlers/auto_import.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'crates/ra_assists/src/handlers') 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 { group.finish() } +#[derive(Debug)] struct AutoImportAssets { import_candidate: ImportCandidate, module_with_name_to_import: Module, @@ -449,6 +450,30 @@ mod tests { ); } + #[test] + fn macro_import() { + check_assist( + auto_import, + r" + //- /lib.rs crate:crate_with_macro + #[macro_export] + macro_rules! foo { + () => () + } + + //- /main.rs crate:main deps:crate_with_macro + fn main() { + foo<|> + }", + r"use crate_with_macro::foo; + +fn main() { + foo<|> +} +", + ); + } + #[test] fn auto_import_target() { check_assist_target( -- cgit v1.2.3