Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/tests/predicate.rs')
-rw-r--r--crates/ide-completion/src/tests/predicate.rs25
1 files changed, 10 insertions, 15 deletions
diff --git a/crates/ide-completion/src/tests/predicate.rs b/crates/ide-completion/src/tests/predicate.rs
index c1926359ef..65036f6a22 100644
--- a/crates/ide-completion/src/tests/predicate.rs
+++ b/crates/ide-completion/src/tests/predicate.rs
@@ -1,17 +1,12 @@
//! Completion tests for predicates and bounds.
-use expect_test::{expect, Expect};
+use expect_test::expect;
-use crate::tests::{check_empty, completion_list, BASE_ITEMS_FIXTURE};
-
-fn check(ra_fixture: &str, expect: Expect) {
- let actual = completion_list(&format!("{BASE_ITEMS_FIXTURE}\n{ra_fixture}"));
- expect.assert_eq(&actual)
-}
+use crate::tests::{check, check_with_base_items};
#[test]
fn predicate_start() {
// FIXME: `for` kw
- check(
+ check_with_base_items(
r#"
struct Foo<'lt, T, const C: usize> where $0 {}
"#,
@@ -34,7 +29,7 @@ struct Foo<'lt, T, const C: usize> where $0 {}
#[test]
fn bound_for_type_pred() {
- check(
+ check_with_base_items(
r#"
struct Foo<'lt, T, const C: usize> where T: $0 {}
"#,
@@ -52,7 +47,7 @@ struct Foo<'lt, T, const C: usize> where T: $0 {}
fn bound_for_lifetime_pred() {
// FIXME: should only show lifetimes here, that is we shouldn't get any completions here when not typing
// a `'`
- check(
+ check_with_base_items(
r#"
struct Foo<'lt, T, const C: usize> where 'lt: $0 {}
"#,
@@ -68,7 +63,7 @@ struct Foo<'lt, T, const C: usize> where 'lt: $0 {}
#[test]
fn bound_for_for_pred() {
- check(
+ check_with_base_items(
r#"
struct Foo<'lt, T, const C: usize> where for<'a> T: $0 {}
"#,
@@ -84,7 +79,7 @@ struct Foo<'lt, T, const C: usize> where for<'a> T: $0 {}
#[test]
fn param_list_for_for_pred() {
- check(
+ check_with_base_items(
r#"
struct Foo<'lt, T, const C: usize> where for<'a> $0 {}
"#,
@@ -107,7 +102,7 @@ struct Foo<'lt, T, const C: usize> where for<'a> $0 {}
#[test]
fn pred_on_fn_in_impl() {
- check(
+ check_with_base_items(
r#"
impl Record {
fn method(self) where $0 {}
@@ -132,7 +127,7 @@ impl Record {
#[test]
fn pred_no_unstable_item_on_stable() {
- check_empty(
+ check(
r#"
//- /main.rs crate:main deps:std
use std::*;
@@ -151,7 +146,7 @@ pub trait Trait {}
#[test]
fn pred_unstable_item_on_nightly() {
- check_empty(
+ check(
r#"
//- toolchain:nightly
//- /main.rs crate:main deps:std