aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src')
-rw-r--r--crates/ide/src/syntax_highlighting/tests.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs
index 1854da914..4a1229a31 100644
--- a/crates/ide/src/syntax_highlighting/tests.rs
+++ b/crates/ide/src/syntax_highlighting/tests.rs
@@ -1,7 +1,5 @@
1use std::fs;
2
3use expect_test::{expect_file, ExpectFile}; 1use expect_test::{expect_file, ExpectFile};
4use test_utils::project_dir; 2use test_utils::{bench, bench_fixture, skip_slow_tests};
5 3
6use crate::{fixture, FileRange, TextRange}; 4use crate::{fixture, FileRange, TextRange};
7 5
@@ -228,15 +226,19 @@ fn bar() {
228} 226}
229 227
230#[test] 228#[test]
231fn accidentally_quadratic() { 229fn benchmark_syntax_highlighting() {
232 let file = project_dir().join("crates/syntax/test_data/accidentally_quadratic"); 230 if skip_slow_tests() {
233 let src = fs::read_to_string(file).unwrap(); 231 return;
232 }
234 233
235 let (analysis, file_id) = fixture::file(&src); 234 let fixture = bench_fixture::big_struct();
235 let (analysis, file_id) = fixture::file(&fixture);
236 236
237 // let t = std::time::Instant::now(); 237 let hash = {
238 let _ = analysis.highlight(file_id).unwrap(); 238 let _pt = bench("syntax highlighting");
239 // eprintln!("elapsed: {:?}", t.elapsed()); 239 analysis.highlight(file_id).unwrap().len()
240 };
241 assert_eq!(hash, 32009);
240} 242}
241 243
242#[test] 244#[test]