aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/tests
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-06-16 20:45:02 +0100
committerLukas Wirth <[email protected]>2021-06-16 20:51:52 +0100
commitaa644b55859c6b5c6695a5d4fb35d1b6efbbebcc (patch)
tree47119538effd381ecd8e15d422103512f2b47406 /crates/ide_completion/src/tests
parent11115ebad8d0cb367478a4f154abe08c0c25aa95 (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.rs32
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 @@
1use expect_test::expect; 1use expect_test::{expect, Expect};
2 2
3use crate::tests::check; 3use crate::tests::completion_list;
4
5fn check(ra_fixture: &str, expect: Expect) {
6 let base = r#"#[rustc_builtin_macro]
7pub macro Clone {}
8enum Enum { Variant }
9struct Struct {}
10#[macro_export]
11macro_rules! foo {}
12mod bar {}
13const CONST: () = ();
14trait Trait {}
15"#;
16 let actual = completion_list(&format!("{}{}", base, ra_fixture));
17 expect.assert_eq(&actual)
18}
4 19
5#[test] 20#[test]
6fn in_mod_item_list() { 21fn 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]
165fn in_impl_assoc_item_list() { 177fn 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]
185fn in_impl_assoc_item_list_after_attr() { 195fn 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