From 20d521db7484cf8ca7939d56493fac7800c444f5 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sun, 17 Mar 2024 11:27:39 +0100 Subject: [PATCH] Adjust `benchmark_syntax_highlighting_parser` for changes --- .../test_data/highlight_const.html | 83 +++++++++++++++++++ crates/ide/src/syntax_highlighting/tests.rs | 4 +- 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 crates/ide/src/syntax_highlighting/test_data/highlight_const.html diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_const.html b/crates/ide/src/syntax_highlighting/test_data/highlight_const.html new file mode 100644 index 00000000000..cd6ffc2c3ae --- /dev/null +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_const.html @@ -0,0 +1,83 @@ + + +
macro_rules! id {
+    ($($tt:tt)*) => {
+        $($tt)*
+    };
+}
+const CONST_ITEM: *const () = &raw const ();
+const fn const_fn<const CONST_PARAM: ()>(const {}: const fn()) where (): const ConstTrait {
+    CONST_ITEM;
+    CONST_PARAM;
+    const {
+        const || {}
+    }
+    id!(
+        CONST_ITEM;
+        CONST_PARAM;
+        const {
+            const || {}
+        };
+        &raw const ();
+        const
+    );
+}
+trait ConstTrait {
+    const ASSOC_CONST: () = ();
+    const fn assoc_const_fn() {}
+}
+impl const ConstTrait for () {
+    const ASSOC_CONST: () = ();
+    const fn assoc_const_fn() {}
+}
+
+macro_rules! unsafe_deref {
+    () => {
+        *(&() as *const ())
+    };
+}
\ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs index a2bec3dbd23..f4a9623fc88 100644 --- a/crates/ide/src/syntax_highlighting/tests.rs +++ b/crates/ide/src/syntax_highlighting/tests.rs @@ -1219,7 +1219,9 @@ fn benchmark_syntax_highlighting_parser() { .highlight(HL_CONFIG, file_id) .unwrap() .iter() - .filter(|it| it.highlight.tag == HlTag::Symbol(SymbolKind::Function)) + .filter(|it| { + matches!(it.highlight.tag, HlTag::Symbol(SymbolKind::Function | SymbolKind::Method)) + }) .count() }; assert_eq!(hash, 1169);