aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/syntax_highlighting/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/syntax_highlighting/tests.rs')
-rw-r--r--crates/ra_ide/src/syntax_highlighting/tests.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting/tests.rs b/crates/ra_ide/src/syntax_highlighting/tests.rs
index 98c030791..110887c2a 100644
--- a/crates/ra_ide/src/syntax_highlighting/tests.rs
+++ b/crates/ra_ide/src/syntax_highlighting/tests.rs
@@ -131,3 +131,28 @@ fn test_ranges() {
131 131
132 assert_eq!(&highlights[0].highlight.to_string(), "field.declaration"); 132 assert_eq!(&highlights[0].highlight.to_string(), "field.declaration");
133} 133}
134
135#[test]
136fn test_flattening() {
137 let (analysis, file_id) = single_file(
138 r##"
139fn fixture(ra_fixture: &str) {}
140
141fn main() {
142 fixture(r#"
143 trait Foo {
144 fn foo() {
145 println!("2 + 2 = {}", 4);
146 }
147 }"#
148 );
149}"##
150 .trim(),
151 );
152
153 let dst_file = project_dir().join("crates/ra_ide/src/snapshots/highlight_injection.html");
154 let actual_html = &analysis.highlight_as_html(file_id, false).unwrap();
155 let expected_html = &read_text(&dst_file);
156 fs::write(dst_file, &actual_html).unwrap();
157 assert_eq_text!(expected_html, actual_html);
158}