mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
switch to insta for testing
This commit is contained in:
parent
8caff4e034
commit
d79a9b17dc
20 changed files with 495 additions and 195 deletions
|
@ -34,7 +34,8 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Cancelable<Vec<Hi
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::mock_analysis::single_file;
|
||||
use test_utils::assert_eq_dbg;
|
||||
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
|
||||
#[test]
|
||||
fn highlights_code_inside_macros() {
|
||||
|
@ -47,25 +48,7 @@ mod tests {
|
|||
",
|
||||
);
|
||||
let highlights = analysis.highlight(file_id).unwrap();
|
||||
assert_eq_dbg(
|
||||
r#"[HighlightedRange { range: [13; 15), tag: "keyword" },
|
||||
HighlightedRange { range: [16; 20), tag: "function" },
|
||||
HighlightedRange { range: [41; 46), tag: "macro" },
|
||||
HighlightedRange { range: [49; 52), tag: "keyword" },
|
||||
HighlightedRange { range: [57; 59), tag: "literal" },
|
||||
HighlightedRange { range: [82; 86), tag: "macro" },
|
||||
HighlightedRange { range: [89; 92), tag: "keyword" },
|
||||
HighlightedRange { range: [97; 99), tag: "literal" },
|
||||
HighlightedRange { range: [49; 52), tag: "keyword" },
|
||||
HighlightedRange { range: [53; 54), tag: "function" },
|
||||
HighlightedRange { range: [57; 59), tag: "literal" },
|
||||
HighlightedRange { range: [61; 62), tag: "text" },
|
||||
HighlightedRange { range: [89; 92), tag: "keyword" },
|
||||
HighlightedRange { range: [93; 94), tag: "function" },
|
||||
HighlightedRange { range: [97; 99), tag: "literal" },
|
||||
HighlightedRange { range: [101; 102), tag: "text" }]"#,
|
||||
&highlights,
|
||||
)
|
||||
assert_debug_snapshot_matches!("highlights_code_inside_macros", &highlights);
|
||||
}
|
||||
|
||||
// FIXME: this test is not really necessary: artifact of the inital hacky
|
||||
|
@ -80,13 +63,6 @@ mod tests {
|
|||
",
|
||||
);
|
||||
let highlights = analysis.highlight(file_id).unwrap();
|
||||
assert_eq_dbg(
|
||||
r#"[HighlightedRange { range: [20; 32), tag: "macro" },
|
||||
HighlightedRange { range: [13; 18), tag: "text" },
|
||||
HighlightedRange { range: [51; 54), tag: "keyword" },
|
||||
HighlightedRange { range: [55; 60), tag: "keyword" },
|
||||
HighlightedRange { range: [61; 72), tag: "function" }]"#,
|
||||
&highlights,
|
||||
)
|
||||
assert_debug_snapshot_matches!("highlight_query_group_macro", &highlights);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue