From d6e6a98c03b1a584ed0829bdda24e2c47a742885 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 26 May 2019 20:11:18 +0800 Subject: Add Test for new item resolution --- crates/ra_hir/src/nameres/tests/macros.rs | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'crates/ra_hir/src/nameres/tests') diff --git a/crates/ra_hir/src/nameres/tests/macros.rs b/crates/ra_hir/src/nameres/tests/macros.rs index f7ca380ad..42241aeff 100644 --- a/crates/ra_hir/src/nameres/tests/macros.rs +++ b/crates/ra_hir/src/nameres/tests/macros.rs @@ -92,3 +92,43 @@ fn macro_rules_from_other_crates_are_visible() { â‹®bar: t "###); } + +#[test] +fn unexpanded_macro_should_expand_by_fixedpoint_loop() { + let map = def_map_with_crate_graph( + " + //- /main.rs + macro_rules! baz { + () => { + use foo::bar; + } + } + + foo!(); + bar!(); + baz!(); + + //- /lib.rs + #[macro_export] + macro_rules! foo { + () => { + struct Foo { field: u32 } + } + } + #[macro_export] + macro_rules! bar { + () => { + use foo::foo; + } + } + ", + crate_graph! { + "main": ("/main.rs", ["foo"]), + "foo": ("/lib.rs", []), + }, + ); + assert_snapshot_matches!(map, @r###"crate +Foo: t v +bar: m +foo: m"###); +} -- cgit v1.2.3