From bfa99f20ffeaf2ef6f2647f2fc8c7b708c7d75d3 Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Wed, 10 Feb 2021 00:16:00 +0100 Subject: [PATCH] Add #[track_caller] to assist tests --- crates/assists/src/tests.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/assists/src/tests.rs b/crates/assists/src/tests.rs index 32bd8698b1..b27f6bf753 100644 --- a/crates/assists/src/tests.rs +++ b/crates/assists/src/tests.rs @@ -49,14 +49,17 @@ pub(crate) fn check_assist_by_label( // FIXME: instead of having a separate function here, maybe use // `extract_ranges` and mark the target as ` ` in the // fixture? +#[track_caller] pub(crate) fn check_assist_target(assist: Handler, ra_fixture: &str, target: &str) { check(assist, ra_fixture, ExpectedResult::Target(target), None); } +#[track_caller] pub(crate) fn check_assist_not_applicable(assist: Handler, ra_fixture: &str) { check(assist, ra_fixture, ExpectedResult::NotApplicable, None); } +#[track_caller] fn check_doc_test(assist_id: &str, before: &str, after: &str) { let after = trim_indent(after); let (db, file_id, selection) = RootDatabase::with_range_or_offset(&before); @@ -95,6 +98,7 @@ enum ExpectedResult<'a> { Target(&'a str), } +#[track_caller] fn check(handler: Handler, before: &str, expected: ExpectedResult, assist_label: Option<&str>) { let (db, file_with_caret_id, range_or_offset) = RootDatabase::with_range_or_offset(before); let text_without_caret = db.file_text(file_with_caret_id).to_string();