Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/tests.rs')
| -rw-r--r-- | crates/ide-completion/src/tests.rs | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/crates/ide-completion/src/tests.rs b/crates/ide-completion/src/tests.rs index 71d143a2b7..a37cf59485 100644 --- a/crates/ide-completion/src/tests.rs +++ b/crates/ide-completion/src/tests.rs @@ -89,22 +89,24 @@ pub(crate) const TEST_CONFIG: CompletionConfig<'_> = CompletionConfig { exclude_traits: &[], }; -pub(crate) fn completion_list(ra_fixture: &str) -> String { +pub(crate) fn completion_list(#[rust_analyzer::rust_fixture] ra_fixture: &str) -> String { completion_list_with_config(TEST_CONFIG, ra_fixture, true, None) } -pub(crate) fn completion_list_no_kw(ra_fixture: &str) -> String { +pub(crate) fn completion_list_no_kw(#[rust_analyzer::rust_fixture] ra_fixture: &str) -> String { completion_list_with_config(TEST_CONFIG, ra_fixture, false, None) } -pub(crate) fn completion_list_no_kw_with_private_editable(ra_fixture: &str) -> String { +pub(crate) fn completion_list_no_kw_with_private_editable( + #[rust_analyzer::rust_fixture] ra_fixture: &str, +) -> String { let mut config = TEST_CONFIG; config.enable_private_editable = true; completion_list_with_config(config, ra_fixture, false, None) } pub(crate) fn completion_list_with_trigger_character( - ra_fixture: &str, + #[rust_analyzer::rust_fixture] ra_fixture: &str, trigger_character: Option<char>, ) -> String { completion_list_with_config(TEST_CONFIG, ra_fixture, true, trigger_character) @@ -112,7 +114,7 @@ pub(crate) fn completion_list_with_trigger_character( fn completion_list_with_config_raw( config: CompletionConfig<'_>, - ra_fixture: &str, + #[rust_analyzer::rust_fixture] ra_fixture: &str, include_keywords: bool, trigger_character: Option<char>, ) -> Vec<CompletionItem> { @@ -135,7 +137,7 @@ fn completion_list_with_config_raw( fn completion_list_with_config( config: CompletionConfig<'_>, - ra_fixture: &str, + #[rust_analyzer::rust_fixture] ra_fixture: &str, include_keywords: bool, trigger_character: Option<char>, ) -> String { @@ -148,7 +150,9 @@ fn completion_list_with_config( } /// Creates analysis from a multi-file fixture, returns positions marked with $0. -pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { +pub(crate) fn position( + #[rust_analyzer::rust_fixture] ra_fixture: &str, +) -> (RootDatabase, FilePosition) { let change_fixture = ChangeFixture::parse(ra_fixture); let mut database = RootDatabase::default(); database.enable_proc_attr_macros(); @@ -253,27 +257,33 @@ pub(crate) fn check_edit_with_config( assert_eq_text!(&ra_fixture_after, &actual) } -pub(crate) fn check(ra_fixture: &str, expect: Expect) { +pub(crate) fn check(#[rust_analyzer::rust_fixture] ra_fixture: &str, expect: Expect) { let actual = completion_list(ra_fixture); expect.assert_eq(&actual); } -pub(crate) fn check_with_base_items(ra_fixture: &str, expect: Expect) { +pub(crate) fn check_with_base_items( + #[rust_analyzer::rust_fixture] ra_fixture: &str, + expect: Expect, +) { check(&format!("{BASE_ITEMS_FIXTURE}{ra_fixture}"), expect) } -pub(crate) fn check_no_kw(ra_fixture: &str, expect: Expect) { +pub(crate) fn check_no_kw(#[rust_analyzer::rust_fixture] ra_fixture: &str, expect: Expect) { let actual = completion_list_no_kw(ra_fixture); expect.assert_eq(&actual) } -pub(crate) fn check_with_private_editable(ra_fixture: &str, expect: Expect) { +pub(crate) fn check_with_private_editable( + #[rust_analyzer::rust_fixture] ra_fixture: &str, + expect: Expect, +) { let actual = completion_list_no_kw_with_private_editable(ra_fixture); expect.assert_eq(&actual); } pub(crate) fn check_with_trigger_character( - ra_fixture: &str, + #[rust_analyzer::rust_fixture] ra_fixture: &str, trigger_character: Option<char>, expect: Expect, ) { |