aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r--crates/ra_hir_def/src/nameres/tests.rs4
-rw-r--r--crates/ra_hir_def/src/nameres/tests/globs.rs92
-rw-r--r--crates/ra_hir_def/src/nameres/tests/macros.rs34
-rw-r--r--crates/ra_hir_def/src/nameres/tests/mod_resolution.rs84
4 files changed, 107 insertions, 107 deletions
diff --git a/crates/ra_hir_def/src/nameres/tests.rs b/crates/ra_hir_def/src/nameres/tests.rs
index 3f33a75b9..949ca7595 100644
--- a/crates/ra_hir_def/src/nameres/tests.rs
+++ b/crates/ra_hir_def/src/nameres/tests.rs
@@ -12,8 +12,8 @@ use test_utils::covers;
12 12
13use crate::{db::DefDatabase, nameres::*, test_db::TestDB}; 13use crate::{db::DefDatabase, nameres::*, test_db::TestDB};
14 14
15fn def_map(fixture: &str) -> String { 15fn def_map(ra_fixture: &str) -> String {
16 compute_crate_def_map(fixture).dump() 16 compute_crate_def_map(ra_fixture).dump()
17} 17}
18 18
19fn compute_crate_def_map(fixture: &str) -> Arc<CrateDefMap> { 19fn compute_crate_def_map(fixture: &str) -> Arc<CrateDefMap> {
diff --git a/crates/ra_hir_def/src/nameres/tests/globs.rs b/crates/ra_hir_def/src/nameres/tests/globs.rs
index 71fa0abe8..ee8df3a26 100644
--- a/crates/ra_hir_def/src/nameres/tests/globs.rs
+++ b/crates/ra_hir_def/src/nameres/tests/globs.rs
@@ -3,7 +3,7 @@ use super::*;
3#[test] 3#[test]
4fn glob_1() { 4fn glob_1() {
5 let map = def_map( 5 let map = def_map(
6 " 6 r"
7 //- /lib.rs 7 //- /lib.rs
8 mod foo; 8 mod foo;
9 use foo::*; 9 use foo::*;
@@ -76,7 +76,7 @@ fn glob_2() {
76#[test] 76#[test]
77fn glob_privacy_1() { 77fn glob_privacy_1() {
78 let map = def_map( 78 let map = def_map(
79 " 79 r"
80 //- /lib.rs 80 //- /lib.rs
81 mod foo; 81 mod foo;
82 use foo::*; 82 use foo::*;
@@ -93,21 +93,21 @@ fn glob_privacy_1() {
93 ", 93 ",
94 ); 94 );
95 assert_snapshot!(map, @r###" 95 assert_snapshot!(map, @r###"
96 crate 96 crate
97 Baz: t v 97 Baz: t v
98 bar: t 98 bar: t
99 foo: t 99 foo: t
100 100
101 crate::foo 101 crate::foo
102 Baz: t v 102 Baz: t v
103 PrivateStructFoo: t v 103 PrivateStructFoo: t v
104 bar: t 104 bar: t
105 105
106 crate::foo::bar 106 crate::foo::bar
107 Baz: t v 107 Baz: t v
108 PrivateStructBar: t v 108 PrivateStructBar: t v
109 PrivateStructFoo: t v 109 PrivateStructFoo: t v
110 bar: t 110 bar: t
111 "### 111 "###
112 ); 112 );
113} 113}
@@ -115,7 +115,7 @@ fn glob_privacy_1() {
115#[test] 115#[test]
116fn glob_privacy_2() { 116fn glob_privacy_2() {
117 let map = def_map( 117 let map = def_map(
118 " 118 r"
119 //- /lib.rs 119 //- /lib.rs
120 mod foo; 120 mod foo;
121 use foo::*; 121 use foo::*;
@@ -133,19 +133,19 @@ fn glob_privacy_2() {
133 ", 133 ",
134 ); 134 );
135 assert_snapshot!(map, @r###" 135 assert_snapshot!(map, @r###"
136 crate 136 crate
137 Foo: t 137 Foo: t
138 PubCrateStruct: t v 138 PubCrateStruct: t v
139 foo: t 139 foo: t
140 140
141 crate::foo 141 crate::foo
142 Foo: t v 142 Foo: t v
143 bar: t 143 bar: t
144 144
145 crate::foo::bar 145 crate::foo::bar
146 PrivateBar: t v 146 PrivateBar: t v
147 PrivateBaz: t v 147 PrivateBaz: t v
148 PubCrateStruct: t v 148 PubCrateStruct: t v
149 "### 149 "###
150 ); 150 );
151} 151}
@@ -154,7 +154,7 @@ fn glob_privacy_2() {
154fn glob_across_crates() { 154fn glob_across_crates() {
155 covers!(glob_across_crates); 155 covers!(glob_across_crates);
156 let map = def_map( 156 let map = def_map(
157 " 157 r"
158 //- /main.rs crate:main deps:test_crate 158 //- /main.rs crate:main deps:test_crate
159 use test_crate::*; 159 use test_crate::*;
160 160
@@ -163,8 +163,8 @@ fn glob_across_crates() {
163 ", 163 ",
164 ); 164 );
165 assert_snapshot!(map, @r###" 165 assert_snapshot!(map, @r###"
166 ⋮crate 166 ⋮crate
167 ⋮Baz: t v 167 ⋮Baz: t v
168 "### 168 "###
169 ); 169 );
170} 170}
@@ -173,7 +173,7 @@ fn glob_across_crates() {
173fn glob_privacy_across_crates() { 173fn glob_privacy_across_crates() {
174 covers!(glob_across_crates); 174 covers!(glob_across_crates);
175 let map = def_map( 175 let map = def_map(
176 " 176 r"
177 //- /main.rs crate:main deps:test_crate 177 //- /main.rs crate:main deps:test_crate
178 use test_crate::*; 178 use test_crate::*;
179 179
@@ -183,8 +183,8 @@ fn glob_privacy_across_crates() {
183 ", 183 ",
184 ); 184 );
185 assert_snapshot!(map, @r###" 185 assert_snapshot!(map, @r###"
186 ⋮crate 186 ⋮crate
187 ⋮Baz: t v 187 ⋮Baz: t v
188 "### 188 "###
189 ); 189 );
190} 190}
@@ -202,10 +202,10 @@ fn glob_enum() {
202 ", 202 ",
203 ); 203 );
204 assert_snapshot!(map, @r###" 204 assert_snapshot!(map, @r###"
205 ⋮crate 205 ⋮crate
206 ⋮Bar: t v 206 ⋮Bar: t v
207 ⋮Baz: t v 207 ⋮Baz: t v
208 ⋮Foo: t 208 ⋮Foo: t
209 "### 209 "###
210 ); 210 );
211} 211}
@@ -214,7 +214,7 @@ fn glob_enum() {
214fn glob_enum_group() { 214fn glob_enum_group() {
215 covers!(glob_enum_group); 215 covers!(glob_enum_group);
216 let map = def_map( 216 let map = def_map(
217 " 217 r"
218 //- /lib.rs 218 //- /lib.rs
219 enum Foo { 219 enum Foo {
220 Bar, Baz 220 Bar, Baz
@@ -223,10 +223,10 @@ fn glob_enum_group() {
223 ", 223 ",
224 ); 224 );
225 assert_snapshot!(map, @r###" 225 assert_snapshot!(map, @r###"
226 ⋮crate 226 ⋮crate
227 ⋮Bar: t v 227 ⋮Bar: t v
228 ⋮Baz: t v 228 ⋮Baz: t v
229 ⋮Foo: t 229 ⋮Foo: t
230 "### 230 "###
231 ); 231 );
232} 232}
diff --git a/crates/ra_hir_def/src/nameres/tests/macros.rs b/crates/ra_hir_def/src/nameres/tests/macros.rs
index d104f5993..b0befdfbd 100644
--- a/crates/ra_hir_def/src/nameres/tests/macros.rs
+++ b/crates/ra_hir_def/src/nameres/tests/macros.rs
@@ -3,7 +3,7 @@ use super::*;
3#[test] 3#[test]
4fn macro_rules_are_globally_visible() { 4fn macro_rules_are_globally_visible() {
5 let map = def_map( 5 let map = def_map(
6 " 6 r"
7 //- /lib.rs 7 //- /lib.rs
8 macro_rules! structs { 8 macro_rules! structs {
9 ($($i:ident),*) => { 9 ($($i:ident),*) => {
@@ -31,7 +31,7 @@ fn macro_rules_are_globally_visible() {
31#[test] 31#[test]
32fn macro_rules_can_define_modules() { 32fn macro_rules_can_define_modules() {
33 let map = def_map( 33 let map = def_map(
34 " 34 r"
35 //- /lib.rs 35 //- /lib.rs
36 macro_rules! m { 36 macro_rules! m {
37 ($name:ident) => { mod $name; } 37 ($name:ident) => { mod $name; }
@@ -51,21 +51,21 @@ fn macro_rules_can_define_modules() {
51 ", 51 ",
52 ); 52 );
53 assert_snapshot!(map, @r###" 53 assert_snapshot!(map, @r###"
54 crate 54 crate
55 m: t 55 m: t
56 n1: t 56 n1: t
57 57
58 crate::m 58 crate::m
59 n3: t 59 n3: t
60 60
61 crate::m::n3 61 crate::m::n3
62 Y: t v 62 Y: t v
63 63
64 crate::n1 64 crate::n1
65 n2: t 65 n2: t
66 66
67 crate::n1::n2 67 crate::n1::n2
68 X: t v 68 X: t v
69 "###); 69 "###);
70} 70}
71 71
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 22103ab29..b502a4079 100644
--- a/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs
+++ b/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs
@@ -4,7 +4,7 @@ use super::*;
4fn name_res_works_for_broken_modules() { 4fn name_res_works_for_broken_modules() {
5 covers!(name_res_works_for_broken_modules); 5 covers!(name_res_works_for_broken_modules);
6 let map = def_map( 6 let map = def_map(
7 " 7 r"
8 //- /lib.rs 8 //- /lib.rs
9 mod foo // no `;`, no body 9 mod foo // no `;`, no body
10 10
@@ -28,7 +28,7 @@ fn name_res_works_for_broken_modules() {
28#[test] 28#[test]
29fn nested_module_resolution() { 29fn nested_module_resolution() {
30 let map = def_map( 30 let map = def_map(
31 " 31 r"
32 //- /lib.rs 32 //- /lib.rs
33 mod n1; 33 mod n1;
34 34
@@ -55,7 +55,7 @@ fn nested_module_resolution() {
55#[test] 55#[test]
56fn nested_module_resolution_2() { 56fn nested_module_resolution_2() {
57 let map = def_map( 57 let map = def_map(
58 " 58 r"
59 //- /lib.rs 59 //- /lib.rs
60 mod prelude; 60 mod prelude;
61 mod iter; 61 mod iter;
@@ -77,23 +77,23 @@ fn nested_module_resolution_2() {
77 ); 77 );
78 78
79 assert_snapshot!(map, @r###" 79 assert_snapshot!(map, @r###"
80 crate 80 crate
81 iter: t 81 iter: t
82 prelude: t 82 prelude: t
83 83
84 crate::iter 84 crate::iter
85 Iterator: t 85 Iterator: t
86 traits: t 86 traits: t
87 87
88 crate::iter::traits 88 crate::iter::traits
89 Iterator: t 89 Iterator: t
90 iterator: t 90 iterator: t
91 91
92 crate::iter::traits::iterator 92 crate::iter::traits::iterator
93 Iterator: t 93 Iterator: t
94 94
95 crate::prelude 95 crate::prelude
96 Iterator: t 96 Iterator: t
97 "###); 97 "###);
98} 98}
99 99
@@ -780,17 +780,17 @@ fn nested_out_of_line_module() {
780 ); 780 );
781 781
782 assert_snapshot!(map, @r###" 782 assert_snapshot!(map, @r###"
783 crate 783 crate
784 a: t 784 a: t
785 785
786 crate::a 786 crate::a
787 b: t 787 b: t
788 788
789 crate::a::b 789 crate::a::b
790 c: t 790 c: t
791 791
792 crate::a::b::c 792 crate::a::b::c
793 X: t v 793 X: t v
794 "###); 794 "###);
795} 795}
796 796
@@ -812,16 +812,16 @@ fn nested_out_of_line_module_with_path() {
812 ); 812 );
813 813
814 assert_snapshot!(map, @r###" 814 assert_snapshot!(map, @r###"
815 crate 815 crate
816 a: t 816 a: t
817 817
818 crate::a 818 crate::a
819 b: t 819 b: t
820 820
821 crate::a::b 821 crate::a::b
822 c: t 822 c: t
823 823
824 crate::a::b::c 824 crate::a::b::c
825 X: t v 825 X: t v
826 "###); 826 "###);
827} 827}