mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-12-15 21:34:19 +00:00
Add #[track_caller] to assist tests
This commit is contained in:
parent
36465b34b3
commit
bfa99f20ff
1 changed files with 4 additions and 0 deletions
|
|
@ -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 `<target> </target>` 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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue