blob: ab7ec9d62daf2310263c9f78da9e1fd0169a59e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
use super::*;
#[test]
fn inner_item_smoke() {
check_at(
r#"
//- /lib.rs
struct inner {}
fn outer() {
$0
fn inner() {}
}
"#,
expect![[r#"
block scope
inner: v
crate
inner: t
outer: v
"#]],
);
}
#[test]
fn use_from_crate() {
check_at(
r#"
//- /lib.rs
struct Struct;
fn outer() {
use Struct;
use crate::Struct as CrateStruct;
use self::Struct as SelfStruct;
$0
}
"#,
expect![[r#"
block scope
CrateStruct: t v
SelfStruct: t v
Struct: t v
crate
Struct: t v
outer: v
"#]],
);
}
#[test]
fn merge_namespaces() {
check_at(
r#"
//- /lib.rs
struct name {}
fn outer() {
fn name() {}
use name as imported; // should import both `name`s
$0
}
"#,
expect![[r#"
block scope
imported: t v
name: v
crate
name: t
outer: v
"#]],
);
}
|