diff options
author | Lukas Wirth <[email protected]> | 2021-06-16 20:45:02 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-06-16 20:51:52 +0100 |
commit | aa644b55859c6b5c6695a5d4fb35d1b6efbbebcc (patch) | |
tree | 47119538effd381ecd8e15d422103512f2b47406 /crates/ide_completion/src/tests | |
parent | 11115ebad8d0cb367478a4f154abe08c0c25aa95 (diff) |
Move test_utils into tests module
Diffstat (limited to 'crates/ide_completion/src/tests')
-rw-r--r-- | crates/ide_completion/src/tests/item_list.rs | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/crates/ide_completion/src/tests/item_list.rs b/crates/ide_completion/src/tests/item_list.rs index 33b23b8b4..7c124ac37 100644 --- a/crates/ide_completion/src/tests/item_list.rs +++ b/crates/ide_completion/src/tests/item_list.rs | |||
@@ -1,14 +1,26 @@ | |||
1 | use expect_test::expect; | 1 | use expect_test::{expect, Expect}; |
2 | 2 | ||
3 | use crate::tests::check; | 3 | use crate::tests::completion_list; |
4 | |||
5 | fn check(ra_fixture: &str, expect: Expect) { | ||
6 | let base = r#"#[rustc_builtin_macro] | ||
7 | pub macro Clone {} | ||
8 | enum Enum { Variant } | ||
9 | struct Struct {} | ||
10 | #[macro_export] | ||
11 | macro_rules! foo {} | ||
12 | mod bar {} | ||
13 | const CONST: () = (); | ||
14 | trait Trait {} | ||
15 | "#; | ||
16 | let actual = completion_list(&format!("{}{}", base, ra_fixture)); | ||
17 | expect.assert_eq(&actual) | ||
18 | } | ||
4 | 19 | ||
5 | #[test] | 20 | #[test] |
6 | fn in_mod_item_list() { | 21 | fn in_mod_item_list() { |
7 | check( | 22 | check( |
8 | r#"mod tests { | 23 | r#"mod tests { $0 }"#, |
9 | $0 | ||
10 | } | ||
11 | "#, | ||
12 | expect![[r##" | 24 | expect![[r##" |
13 | kw pub(crate) | 25 | kw pub(crate) |
14 | kw pub | 26 | kw pub |
@@ -164,9 +176,7 @@ fn after_visibility_unsafe() { | |||
164 | #[test] | 176 | #[test] |
165 | fn in_impl_assoc_item_list() { | 177 | fn in_impl_assoc_item_list() { |
166 | check( | 178 | check( |
167 | r#"impl Struct { | 179 | r#"impl Struct { $0 }"#, |
168 | $0 | ||
169 | }"#, | ||
170 | expect![[r##" | 180 | expect![[r##" |
171 | kw pub(crate) | 181 | kw pub(crate) |
172 | kw pub | 182 | kw pub |
@@ -184,9 +194,7 @@ fn in_impl_assoc_item_list() { | |||
184 | #[test] | 194 | #[test] |
185 | fn in_impl_assoc_item_list_after_attr() { | 195 | fn in_impl_assoc_item_list_after_attr() { |
186 | check( | 196 | check( |
187 | r#"impl Struct { | 197 | r#"impl Struct { #[attr] $0 }"#, |
188 | #[attr] $0 | ||
189 | }"#, | ||
190 | expect![[r#" | 198 | expect![[r#" |
191 | kw pub(crate) | 199 | kw pub(crate) |
192 | kw pub | 200 | kw pub |