diff options
Diffstat (limited to 'crates/ra_hir/src/nameres/tests')
-rw-r--r-- | crates/ra_hir/src/nameres/tests/macros.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/crates/ra_hir/src/nameres/tests/macros.rs b/crates/ra_hir/src/nameres/tests/macros.rs index 6e0bc437e..bd60f4258 100644 --- a/crates/ra_hir/src/nameres/tests/macros.rs +++ b/crates/ra_hir/src/nameres/tests/macros.rs | |||
@@ -94,6 +94,43 @@ fn macro_rules_from_other_crates_are_visible() { | |||
94 | } | 94 | } |
95 | 95 | ||
96 | #[test] | 96 | #[test] |
97 | fn macro_rules_export_with_local_inner_macros_are_visible() { | ||
98 | let map = def_map_with_crate_graph( | ||
99 | " | ||
100 | //- /main.rs | ||
101 | foo::structs!(Foo, Bar) | ||
102 | mod bar; | ||
103 | |||
104 | //- /bar.rs | ||
105 | use crate::*; | ||
106 | |||
107 | //- /lib.rs | ||
108 | #[macro_export(local_inner_macros)] | ||
109 | macro_rules! structs { | ||
110 | ($($i:ident),*) => { | ||
111 | $(struct $i { field: u32 } )* | ||
112 | } | ||
113 | } | ||
114 | ", | ||
115 | crate_graph! { | ||
116 | "main": ("/main.rs", ["foo"]), | ||
117 | "foo": ("/lib.rs", []), | ||
118 | }, | ||
119 | ); | ||
120 | assert_snapshot!(map, @r###" | ||
121 | ⋮crate | ||
122 | ⋮Bar: t v | ||
123 | ⋮Foo: t v | ||
124 | ⋮bar: t | ||
125 | ⋮ | ||
126 | ⋮crate::bar | ||
127 | ⋮Bar: t v | ||
128 | ⋮Foo: t v | ||
129 | ⋮bar: t | ||
130 | "###); | ||
131 | } | ||
132 | |||
133 | #[test] | ||
97 | fn unexpanded_macro_should_expand_by_fixedpoint_loop() { | 134 | fn unexpanded_macro_should_expand_by_fixedpoint_loop() { |
98 | let map = def_map_with_crate_graph( | 135 | let map = def_map_with_crate_graph( |
99 | " | 136 | " |