aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres/tests
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-05-26 13:11:18 +0100
committerEdwin Cheng <[email protected]>2019-05-26 13:11:18 +0100
commitd6e6a98c03b1a584ed0829bdda24e2c47a742885 (patch)
tree9e7cb2485e3644092a00bda6be9df1c9f1928975 /crates/ra_hir/src/nameres/tests
parentb72074a715cc08b5520c52438c8bb987ddf9038d (diff)
Add Test for new item resolution
Diffstat (limited to 'crates/ra_hir/src/nameres/tests')
-rw-r--r--crates/ra_hir/src/nameres/tests/macros.rs40
1 files changed, 40 insertions, 0 deletions
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() {
92 ⋮bar: t 92 ⋮bar: t
93 "###); 93 "###);
94} 94}
95
96#[test]
97fn unexpanded_macro_should_expand_by_fixedpoint_loop() {
98 let map = def_map_with_crate_graph(
99 "
100 //- /main.rs
101 macro_rules! baz {
102 () => {
103 use foo::bar;
104 }
105 }
106
107 foo!();
108 bar!();
109 baz!();
110
111 //- /lib.rs
112 #[macro_export]
113 macro_rules! foo {
114 () => {
115 struct Foo { field: u32 }
116 }
117 }
118 #[macro_export]
119 macro_rules! bar {
120 () => {
121 use foo::foo;
122 }
123 }
124 ",
125 crate_graph! {
126 "main": ("/main.rs", ["foo"]),
127 "foo": ("/lib.rs", []),
128 },
129 );
130 assert_snapshot_matches!(map, @r###"crate
131Foo: t v
132bar: m
133foo: m"###);
134}