diff options
author | Jonas Schievink <[email protected]> | 2021-01-21 14:22:17 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-01-21 14:22:17 +0000 |
commit | 896dfacfc47068df716fe4969a68adefadb1693e (patch) | |
tree | 4e0a8c6f29611fb4c25be93764f1ab22d1b5a316 /crates/hir_def/src/nameres/tests | |
parent | 0045d7c6db0d9e1e5f88702249c90c096f1882d8 (diff) |
Add name resolution query for block expressions
Diffstat (limited to 'crates/hir_def/src/nameres/tests')
-rw-r--r-- | crates/hir_def/src/nameres/tests/block.rs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/crates/hir_def/src/nameres/tests/block.rs b/crates/hir_def/src/nameres/tests/block.rs new file mode 100644 index 000000000..996704308 --- /dev/null +++ b/crates/hir_def/src/nameres/tests/block.rs | |||
@@ -0,0 +1,47 @@ | |||
1 | use super::*; | ||
2 | |||
3 | #[test] | ||
4 | fn inner_item_smoke() { | ||
5 | check_at( | ||
6 | r#" | ||
7 | //- /lib.rs | ||
8 | struct inner {} | ||
9 | fn outer() { | ||
10 | $0 | ||
11 | fn inner() {} | ||
12 | } | ||
13 | "#, | ||
14 | expect![[r#" | ||
15 | block scope | ||
16 | inner: v | ||
17 | crate | ||
18 | inner: t | ||
19 | outer: v | ||
20 | "#]], | ||
21 | ); | ||
22 | } | ||
23 | |||
24 | #[test] | ||
25 | fn use_from_crate() { | ||
26 | check_at( | ||
27 | r#" | ||
28 | //- /lib.rs | ||
29 | struct Struct; | ||
30 | fn outer() { | ||
31 | use Struct; | ||
32 | use crate::Struct as CrateStruct; | ||
33 | use self::Struct as SelfStruct; | ||
34 | $0 | ||
35 | } | ||
36 | "#, | ||
37 | expect![[r#" | ||
38 | block scope | ||
39 | CrateStruct: t v | ||
40 | SelfStruct: t v | ||
41 | Struct: t v | ||
42 | crate | ||
43 | Struct: t v | ||
44 | outer: v | ||
45 | "#]], | ||
46 | ); | ||
47 | } | ||