diff options
Diffstat (limited to 'crates/ra_hir_def/src/nameres/tests')
-rw-r--r-- | crates/ra_hir_def/src/nameres/tests/globs.rs | 7 | ||||
-rw-r--r-- | crates/ra_hir_def/src/nameres/tests/macros.rs | 70 | ||||
-rw-r--r-- | crates/ra_hir_def/src/nameres/tests/mod_resolution.rs | 2 |
3 files changed, 57 insertions, 22 deletions
diff --git a/crates/ra_hir_def/src/nameres/tests/globs.rs b/crates/ra_hir_def/src/nameres/tests/globs.rs index ee8df3a26..2b12c0daa 100644 --- a/crates/ra_hir_def/src/nameres/tests/globs.rs +++ b/crates/ra_hir_def/src/nameres/tests/globs.rs | |||
@@ -152,7 +152,7 @@ fn glob_privacy_2() { | |||
152 | 152 | ||
153 | #[test] | 153 | #[test] |
154 | fn glob_across_crates() { | 154 | fn glob_across_crates() { |
155 | covers!(glob_across_crates); | 155 | mark::check!(glob_across_crates); |
156 | let map = def_map( | 156 | let map = def_map( |
157 | r" | 157 | r" |
158 | //- /main.rs crate:main deps:test_crate | 158 | //- /main.rs crate:main deps:test_crate |
@@ -171,7 +171,6 @@ fn glob_across_crates() { | |||
171 | 171 | ||
172 | #[test] | 172 | #[test] |
173 | fn glob_privacy_across_crates() { | 173 | fn glob_privacy_across_crates() { |
174 | covers!(glob_across_crates); | ||
175 | let map = def_map( | 174 | let map = def_map( |
176 | r" | 175 | r" |
177 | //- /main.rs crate:main deps:test_crate | 176 | //- /main.rs crate:main deps:test_crate |
@@ -191,7 +190,7 @@ fn glob_privacy_across_crates() { | |||
191 | 190 | ||
192 | #[test] | 191 | #[test] |
193 | fn glob_enum() { | 192 | fn glob_enum() { |
194 | covers!(glob_enum); | 193 | mark::check!(glob_enum); |
195 | let map = def_map( | 194 | let map = def_map( |
196 | " | 195 | " |
197 | //- /lib.rs | 196 | //- /lib.rs |
@@ -212,7 +211,7 @@ fn glob_enum() { | |||
212 | 211 | ||
213 | #[test] | 212 | #[test] |
214 | fn glob_enum_group() { | 213 | fn glob_enum_group() { |
215 | covers!(glob_enum_group); | 214 | mark::check!(glob_enum_group); |
216 | let map = def_map( | 215 | let map = def_map( |
217 | r" | 216 | r" |
218 | //- /lib.rs | 217 | //- /lib.rs |
diff --git a/crates/ra_hir_def/src/nameres/tests/macros.rs b/crates/ra_hir_def/src/nameres/tests/macros.rs index b0befdfbd..84480d9f6 100644 --- a/crates/ra_hir_def/src/nameres/tests/macros.rs +++ b/crates/ra_hir_def/src/nameres/tests/macros.rs | |||
@@ -19,12 +19,12 @@ fn macro_rules_are_globally_visible() { | |||
19 | ); | 19 | ); |
20 | assert_snapshot!(map, @r###" | 20 | assert_snapshot!(map, @r###" |
21 | ⋮crate | 21 | ⋮crate |
22 | ⋮Foo: t v | 22 | ⋮Foo: t |
23 | ⋮nested: t | 23 | ⋮nested: t |
24 | ⋮ | 24 | ⋮ |
25 | ⋮crate::nested | 25 | ⋮crate::nested |
26 | ⋮Bar: t v | 26 | ⋮Bar: t |
27 | ⋮Baz: t v | 27 | ⋮Baz: t |
28 | "###); | 28 | "###); |
29 | } | 29 | } |
30 | 30 | ||
@@ -91,13 +91,13 @@ fn macro_rules_from_other_crates_are_visible() { | |||
91 | ); | 91 | ); |
92 | assert_snapshot!(map, @r###" | 92 | assert_snapshot!(map, @r###" |
93 | ⋮crate | 93 | ⋮crate |
94 | ⋮Bar: t v | 94 | ⋮Bar: t |
95 | ⋮Foo: t v | 95 | ⋮Foo: t |
96 | ⋮bar: t | 96 | ⋮bar: t |
97 | ⋮ | 97 | ⋮ |
98 | ⋮crate::bar | 98 | ⋮crate::bar |
99 | ⋮Bar: t v | 99 | ⋮Bar: t |
100 | ⋮Foo: t v | 100 | ⋮Foo: t |
101 | ⋮bar: t | 101 | ⋮bar: t |
102 | "###); | 102 | "###); |
103 | } | 103 | } |
@@ -124,13 +124,50 @@ fn macro_rules_export_with_local_inner_macros_are_visible() { | |||
124 | ); | 124 | ); |
125 | assert_snapshot!(map, @r###" | 125 | assert_snapshot!(map, @r###" |
126 | ⋮crate | 126 | ⋮crate |
127 | ⋮Bar: t v | 127 | ⋮Bar: t |
128 | ⋮Foo: t v | 128 | ⋮Foo: t |
129 | ⋮bar: t | 129 | ⋮bar: t |
130 | ⋮ | 130 | ⋮ |
131 | ⋮crate::bar | 131 | ⋮crate::bar |
132 | ⋮Bar: t v | 132 | ⋮Bar: t |
133 | ⋮Foo: t v | 133 | ⋮Foo: t |
134 | ⋮bar: t | ||
135 | "###); | ||
136 | } | ||
137 | |||
138 | #[test] | ||
139 | fn local_inner_macros_makes_local_macros_usable() { | ||
140 | let map = def_map( | ||
141 | " | ||
142 | //- /main.rs crate:main deps:foo | ||
143 | foo::structs!(Foo, Bar); | ||
144 | mod bar; | ||
145 | //- /bar.rs | ||
146 | use crate::*; | ||
147 | //- /lib.rs crate:foo | ||
148 | #[macro_export(local_inner_macros)] | ||
149 | macro_rules! structs { | ||
150 | ($($i:ident),*) => { | ||
151 | inner!($($i),*); | ||
152 | } | ||
153 | } | ||
154 | #[macro_export] | ||
155 | macro_rules! inner { | ||
156 | ($($i:ident),*) => { | ||
157 | $(struct $i { field: u32 } )* | ||
158 | } | ||
159 | } | ||
160 | ", | ||
161 | ); | ||
162 | assert_snapshot!(map, @r###" | ||
163 | ⋮crate | ||
164 | ⋮Bar: t | ||
165 | ⋮Foo: t | ||
166 | ⋮bar: t | ||
167 | ⋮ | ||
168 | ⋮crate::bar | ||
169 | ⋮Bar: t | ||
170 | ⋮Foo: t | ||
134 | ⋮bar: t | 171 | ⋮bar: t |
135 | "###); | 172 | "###); |
136 | } | 173 | } |
@@ -167,7 +204,7 @@ fn unexpanded_macro_should_expand_by_fixedpoint_loop() { | |||
167 | ); | 204 | ); |
168 | assert_snapshot!(map, @r###" | 205 | assert_snapshot!(map, @r###" |
169 | ⋮crate | 206 | ⋮crate |
170 | ⋮Foo: t v | 207 | ⋮Foo: t |
171 | ⋮bar: m | 208 | ⋮bar: m |
172 | ⋮foo: m | 209 | ⋮foo: m |
173 | "###); | 210 | "###); |
@@ -175,7 +212,7 @@ fn unexpanded_macro_should_expand_by_fixedpoint_loop() { | |||
175 | 212 | ||
176 | #[test] | 213 | #[test] |
177 | fn macro_rules_from_other_crates_are_visible_with_macro_use() { | 214 | fn macro_rules_from_other_crates_are_visible_with_macro_use() { |
178 | covers!(macro_rules_from_other_crates_are_visible_with_macro_use); | 215 | mark::check!(macro_rules_from_other_crates_are_visible_with_macro_use); |
179 | let map = def_map( | 216 | let map = def_map( |
180 | " | 217 | " |
181 | //- /main.rs crate:main deps:foo | 218 | //- /main.rs crate:main deps:foo |
@@ -225,7 +262,7 @@ fn macro_rules_from_other_crates_are_visible_with_macro_use() { | |||
225 | 262 | ||
226 | #[test] | 263 | #[test] |
227 | fn prelude_is_macro_use() { | 264 | fn prelude_is_macro_use() { |
228 | covers!(prelude_is_macro_use); | 265 | mark::check!(prelude_is_macro_use); |
229 | let map = def_map( | 266 | let map = def_map( |
230 | " | 267 | " |
231 | //- /main.rs crate:main deps:foo | 268 | //- /main.rs crate:main deps:foo |
@@ -507,8 +544,7 @@ fn path_qualified_macros() { | |||
507 | 544 | ||
508 | #[test] | 545 | #[test] |
509 | fn macro_dollar_crate_is_correct_in_item() { | 546 | fn macro_dollar_crate_is_correct_in_item() { |
510 | covers!(macro_dollar_crate_self); | 547 | mark::check!(macro_dollar_crate_self); |
511 | covers!(macro_dollar_crate_other); | ||
512 | let map = def_map( | 548 | let map = def_map( |
513 | " | 549 | " |
514 | //- /main.rs crate:main deps:foo | 550 | //- /main.rs crate:main deps:foo |
@@ -566,7 +602,7 @@ fn macro_dollar_crate_is_correct_in_item() { | |||
566 | 602 | ||
567 | #[test] | 603 | #[test] |
568 | fn macro_dollar_crate_is_correct_in_indirect_deps() { | 604 | fn macro_dollar_crate_is_correct_in_indirect_deps() { |
569 | covers!(macro_dollar_crate_other); | 605 | mark::check!(macro_dollar_crate_other); |
570 | // From std | 606 | // From std |
571 | let map = def_map( | 607 | let map = def_map( |
572 | r#" | 608 | r#" |
diff --git a/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs b/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs index 37fcdfb8c..b43b294ca 100644 --- a/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs +++ b/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs | |||
@@ -2,7 +2,7 @@ use super::*; | |||
2 | 2 | ||
3 | #[test] | 3 | #[test] |
4 | fn name_res_works_for_broken_modules() { | 4 | fn name_res_works_for_broken_modules() { |
5 | covers!(name_res_works_for_broken_modules); | 5 | mark::check!(name_res_works_for_broken_modules); |
6 | let map = def_map( | 6 | let map = def_map( |
7 | r" | 7 | r" |
8 | //- /lib.rs | 8 | //- /lib.rs |