aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres/tests
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/nameres/tests')
-rw-r--r--crates/hir_def/src/nameres/tests/block.rs47
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 @@
1use super::*;
2
3#[test]
4fn inner_item_smoke() {
5 check_at(
6 r#"
7//- /lib.rs
8struct inner {}
9fn 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]
25fn use_from_crate() {
26 check_at(
27 r#"
28//- /lib.rs
29struct Struct;
30fn 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}