Skip to content

internal: Move out expression based unqualified_path completion tests #9683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 0 additions & 69 deletions crates/ide_completion/src/completions/qualified_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,60 +255,6 @@ mod tests {
expect.assert_eq(&actual);
}

fn check_builtin(ra_fixture: &str, expect: Expect) {
let actual = filtered_completion_list(ra_fixture, CompletionKind::BuiltinType);
expect.assert_eq(&actual);
}

#[test]
fn dont_complete_primitive_in_use() {
check_builtin(r#"use self::$0;"#, expect![[""]]);
}

#[test]
fn dont_complete_primitive_in_module_scope() {
check_builtin(r#"fn foo() { self::$0 }"#, expect![[""]]);
}

#[test]
fn completes_enum_variant() {
check(
r#"
enum E { Foo, Bar(i32) }
fn foo() { let _ = E::$0 }
"#,
expect![[r#"
ev Foo ()
ev Bar(…) (i32)
"#]],
);
}

#[test]
fn completes_struct_associated_items() {
check(
r#"
//- /lib.rs
struct S;

impl S {
fn a() {}
fn b(&self) {}
const C: i32 = 42;
type T = i32;
}

fn foo() { let _ = S::$0 }
"#,
expect![[r#"
fn a() fn()
me b(…) fn(&self)
ct C const C: i32 = 42;
ta T type T = i32;
"#]],
);
}

#[test]
fn associated_item_visibility() {
check(
Expand Down Expand Up @@ -336,21 +282,6 @@ fn foo() { let _ = S::$0 }
);
}

#[test]
fn completes_enum_associated_method() {
check(
r#"
enum E {};
impl E { fn m() { } }

fn foo() { let _ = E::$0 }
"#,
expect![[r#"
fn m() fn()
"#]],
);
}

#[test]
fn completes_union_associated_method() {
check(
Expand Down
1 change: 0 additions & 1 deletion crates/ide_completion/src/completions/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ pub(crate) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) ->

#[cfg(test)]
mod tests {

use crate::tests::check_edit;

#[test]
Expand Down
23 changes: 0 additions & 23 deletions crates/ide_completion/src/completions/snippet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,26 +86,3 @@ fn ${1:feature}() {
let item = snippet(ctx, cap, "macro_rules", "macro_rules! $1 {\n\t($2) => {\n\t\t$0\n\t};\n}");
item.add_to(acc);
}

#[cfg(test)]
mod tests {
use expect_test::{expect, Expect};

use crate::{tests::filtered_completion_list, CompletionKind};

fn check(ra_fixture: &str, expect: Expect) {
let actual = filtered_completion_list(ra_fixture, CompletionKind::Snippet);
expect.assert_eq(&actual)
}

#[test]
fn completes_snippets_in_expressions() {
check(
r#"fn foo(x: i32) { $0 }"#,
expect![[r#"
sn pd
sn ppd
"#]],
);
}
}
Loading