diff options
author | Dmitry <[email protected]> | 2020-08-14 19:32:05 +0100 |
---|---|---|
committer | Dmitry <[email protected]> | 2020-08-14 19:32:05 +0100 |
commit | 178c3e135a2a249692f7784712492e7884ae0c00 (patch) | |
tree | ac6b769dbf7162150caa0c1624786a4dd79ff3be /crates/hir_ty/src/tests/display_source_code.rs | |
parent | 06ff8e6c760ff05f10e868b5d1f9d79e42fbb49c (diff) | |
parent | c2594daf2974dbd4ce3d9b7ec72481764abaceb5 (diff) |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'crates/hir_ty/src/tests/display_source_code.rs')
-rw-r--r-- | crates/hir_ty/src/tests/display_source_code.rs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/display_source_code.rs b/crates/hir_ty/src/tests/display_source_code.rs new file mode 100644 index 000000000..b502135d8 --- /dev/null +++ b/crates/hir_ty/src/tests/display_source_code.rs | |||
@@ -0,0 +1,41 @@ | |||
1 | use super::check_types_source_code; | ||
2 | |||
3 | #[test] | ||
4 | fn qualify_path_to_submodule() { | ||
5 | check_types_source_code( | ||
6 | r#" | ||
7 | mod foo { | ||
8 | pub struct Foo; | ||
9 | } | ||
10 | |||
11 | fn bar() { | ||
12 | let foo: foo::Foo = foo::Foo; | ||
13 | foo | ||
14 | } //^ foo::Foo | ||
15 | |||
16 | "#, | ||
17 | ); | ||
18 | } | ||
19 | |||
20 | #[test] | ||
21 | fn omit_default_type_parameters() { | ||
22 | check_types_source_code( | ||
23 | r#" | ||
24 | struct Foo<T = u8> { t: T } | ||
25 | fn main() { | ||
26 | let foo = Foo { t: 5u8 }; | ||
27 | foo; | ||
28 | } //^ Foo | ||
29 | "#, | ||
30 | ); | ||
31 | |||
32 | check_types_source_code( | ||
33 | r#" | ||
34 | struct Foo<K, T = u8> { k: K, t: T } | ||
35 | fn main() { | ||
36 | let foo = Foo { k: 400, t: 5u8 }; | ||
37 | foo; | ||
38 | } //^ Foo<i32> | ||
39 | "#, | ||
40 | ); | ||
41 | } | ||