diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-06-29 16:25:12 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-29 16:25:12 +0100 |
commit | 32ee06032785ea1792144f7263cbce93a4de467b (patch) | |
tree | fac101a18e111a2a05bce14fbb68981c5bef3bfd /crates/ra_hir_ty/src/tests/display_source_code.rs | |
parent | 82ce5792ab70ab8d20a1afde72c5400c27b9c190 (diff) | |
parent | bbc4dc995612916a4c0a99396b5259a5fb1dda80 (diff) |
Merge #5127
5127: Update the rest of the tests r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/tests/display_source_code.rs')
-rw-r--r-- | crates/ra_hir_ty/src/tests/display_source_code.rs | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/crates/ra_hir_ty/src/tests/display_source_code.rs b/crates/ra_hir_ty/src/tests/display_source_code.rs index 5dfa0a014..b502135d8 100644 --- a/crates/ra_hir_ty/src/tests/display_source_code.rs +++ b/crates/ra_hir_ty/src/tests/display_source_code.rs | |||
@@ -1,50 +1,41 @@ | |||
1 | use super::displayed_source_at_pos; | 1 | use super::check_types_source_code; |
2 | use crate::test_db::TestDB; | ||
3 | use ra_db::fixture::WithFixture; | ||
4 | 2 | ||
5 | #[test] | 3 | #[test] |
6 | fn qualify_path_to_submodule() { | 4 | fn qualify_path_to_submodule() { |
7 | let (db, pos) = TestDB::with_position( | 5 | check_types_source_code( |
8 | r#" | 6 | r#" |
9 | //- /main.rs | ||
10 | |||
11 | mod foo { | 7 | mod foo { |
12 | pub struct Foo; | 8 | pub struct Foo; |
13 | } | 9 | } |
14 | 10 | ||
15 | fn bar() { | 11 | fn bar() { |
16 | let foo: foo::Foo = foo::Foo; | 12 | let foo: foo::Foo = foo::Foo; |
17 | foo<|> | 13 | foo |
18 | } | 14 | } //^ foo::Foo |
19 | 15 | ||
20 | "#, | 16 | "#, |
21 | ); | 17 | ); |
22 | assert_eq!("foo::Foo", displayed_source_at_pos(&db, pos)); | ||
23 | } | 18 | } |
24 | 19 | ||
25 | #[test] | 20 | #[test] |
26 | fn omit_default_type_parameters() { | 21 | fn omit_default_type_parameters() { |
27 | let (db, pos) = TestDB::with_position( | 22 | check_types_source_code( |
28 | r" | 23 | r#" |
29 | //- /main.rs | 24 | struct Foo<T = u8> { t: T } |
30 | struct Foo<T = u8> { t: T } | 25 | fn main() { |
31 | fn main() { | 26 | let foo = Foo { t: 5u8 }; |
32 | let foo = Foo { t: 5u8 }; | 27 | foo; |
33 | foo<|>; | 28 | } //^ Foo |
34 | } | 29 | "#, |
35 | ", | ||
36 | ); | 30 | ); |
37 | assert_eq!("Foo", displayed_source_at_pos(&db, pos)); | ||
38 | 31 | ||
39 | let (db, pos) = TestDB::with_position( | 32 | check_types_source_code( |
40 | r" | 33 | r#" |
41 | //- /main.rs | 34 | struct Foo<K, T = u8> { k: K, t: T } |
42 | struct Foo<K, T = u8> { k: K, t: T } | 35 | fn main() { |
43 | fn main() { | 36 | let foo = Foo { k: 400, t: 5u8 }; |
44 | let foo = Foo { k: 400, t: 5u8 }; | 37 | foo; |
45 | foo<|>; | 38 | } //^ Foo<i32> |
46 | } | 39 | "#, |
47 | ", | ||
48 | ); | 40 | ); |
49 | assert_eq!("Foo<i32>", displayed_source_at_pos(&db, pos)); | ||
50 | } | 41 | } |