aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/syntax_highlighting.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/syntax_highlighting.rs')
-rw-r--r--crates/ra_ide_api/src/syntax_highlighting.rs32
1 files changed, 4 insertions, 28 deletions
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs
index cb19e9515..480b78dce 100644
--- a/crates/ra_ide_api/src/syntax_highlighting.rs
+++ b/crates/ra_ide_api/src/syntax_highlighting.rs
@@ -34,7 +34,8 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Cancelable<Vec<Hi
34#[cfg(test)] 34#[cfg(test)]
35mod tests { 35mod tests {
36 use crate::mock_analysis::single_file; 36 use crate::mock_analysis::single_file;
37 use test_utils::assert_eq_dbg; 37
38 use insta::assert_debug_snapshot_matches;
38 39
39 #[test] 40 #[test]
40 fn highlights_code_inside_macros() { 41 fn highlights_code_inside_macros() {
@@ -47,25 +48,7 @@ mod tests {
47 ", 48 ",
48 ); 49 );
49 let highlights = analysis.highlight(file_id).unwrap(); 50 let highlights = analysis.highlight(file_id).unwrap();
50 assert_eq_dbg( 51 assert_debug_snapshot_matches!("highlights_code_inside_macros", &highlights);
51 r#"[HighlightedRange { range: [13; 15), tag: "keyword" },
52 HighlightedRange { range: [16; 20), tag: "function" },
53 HighlightedRange { range: [41; 46), tag: "macro" },
54 HighlightedRange { range: [49; 52), tag: "keyword" },
55 HighlightedRange { range: [57; 59), tag: "literal" },
56 HighlightedRange { range: [82; 86), tag: "macro" },
57 HighlightedRange { range: [89; 92), tag: "keyword" },
58 HighlightedRange { range: [97; 99), tag: "literal" },
59 HighlightedRange { range: [49; 52), tag: "keyword" },
60 HighlightedRange { range: [53; 54), tag: "function" },
61 HighlightedRange { range: [57; 59), tag: "literal" },
62 HighlightedRange { range: [61; 62), tag: "text" },
63 HighlightedRange { range: [89; 92), tag: "keyword" },
64 HighlightedRange { range: [93; 94), tag: "function" },
65 HighlightedRange { range: [97; 99), tag: "literal" },
66 HighlightedRange { range: [101; 102), tag: "text" }]"#,
67 &highlights,
68 )
69 } 52 }
70 53
71 // FIXME: this test is not really necessary: artifact of the inital hacky 54 // FIXME: this test is not really necessary: artifact of the inital hacky
@@ -80,13 +63,6 @@ mod tests {
80 ", 63 ",
81 ); 64 );
82 let highlights = analysis.highlight(file_id).unwrap(); 65 let highlights = analysis.highlight(file_id).unwrap();
83 assert_eq_dbg( 66 assert_debug_snapshot_matches!("highlight_query_group_macro", &highlights);
84 r#"[HighlightedRange { range: [20; 32), tag: "macro" },
85 HighlightedRange { range: [13; 18), tag: "text" },
86 HighlightedRange { range: [51; 54), tag: "keyword" },
87 HighlightedRange { range: [55; 60), tag: "keyword" },
88 HighlightedRange { range: [61; 72), tag: "function" }]"#,
89 &highlights,
90 )
91 } 67 }
92} 68}