mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
Re-order and cleanup highlighting tests
This commit is contained in:
parent
03d33556c9
commit
48189bc1b4
4 changed files with 199 additions and 208 deletions
|
@ -58,5 +58,4 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
|
||||||
<span class="keyword">impl</span> <span class="trait">t</span> <span class="keyword">for</span> <span class="struct">foo</span> <span class="brace">{</span>
|
<span class="keyword">impl</span> <span class="trait">t</span> <span class="keyword">for</span> <span class="struct">foo</span> <span class="brace">{</span>
|
||||||
<span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration public static trait">is_static</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span>
|
<span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration public static trait">is_static</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span>
|
||||||
<span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration public reference trait">is_not_static</span><span class="parenthesis">(</span><span class="operator">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span>
|
<span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration public reference trait">is_not_static</span><span class="parenthesis">(</span><span class="operator">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span>
|
||||||
<span class="brace">}</span>
|
<span class="brace">}</span></code></pre>
|
||||||
</code></pre>
|
|
|
@ -46,5 +46,4 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
|
||||||
<span class="keyword">fn</span> <span class="function declaration">main</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span>
|
<span class="keyword">fn</span> <span class="function declaration">main</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span>
|
||||||
<span class="keyword">let</span> <span class="variable declaration">foo</span> <span class="operator">=</span> <span class="enum_variant default_library library">Some</span><span class="parenthesis">(</span><span class="numeric_literal">92</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
<span class="keyword">let</span> <span class="variable declaration">foo</span> <span class="operator">=</span> <span class="enum_variant default_library library">Some</span><span class="parenthesis">(</span><span class="numeric_literal">92</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
||||||
<span class="keyword">let</span> <span class="variable declaration">nums</span> <span class="operator">=</span> <span class="module default_library library">iter</span><span class="operator">::</span><span class="function default_library library">repeat</span><span class="parenthesis">(</span><span class="variable">foo</span><span class="operator">.</span><span class="function associated consuming default_library library">unwrap</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
<span class="keyword">let</span> <span class="variable declaration">nums</span> <span class="operator">=</span> <span class="module default_library library">iter</span><span class="operator">::</span><span class="function default_library library">repeat</span><span class="parenthesis">(</span><span class="variable">foo</span><span class="operator">.</span><span class="function associated consuming default_library library">unwrap</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
||||||
<span class="brace">}</span>
|
<span class="brace">}</span></code></pre>
|
||||||
</code></pre>
|
|
|
@ -49,5 +49,4 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
|
||||||
<span class="numeric_literal">92</span>
|
<span class="numeric_literal">92</span>
|
||||||
<span class="brace">}</span><span class="keyword">$0</span><span class="parenthesis">)</span>
|
<span class="brace">}</span><span class="keyword">$0</span><span class="parenthesis">)</span>
|
||||||
<span class="brace">}</span><span class="string_literal">"</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
<span class="brace">}</span><span class="string_literal">"</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
||||||
<span class="brace">}</span>
|
<span class="brace">}</span></code></pre>
|
||||||
</code></pre>
|
|
|
@ -288,161 +288,12 @@ macro_rules! die {
|
||||||
panic!();
|
panic!();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
"#
|
"#,
|
||||||
.trim(),
|
|
||||||
expect_file!["./test_data/highlighting.html"],
|
expect_file!["./test_data/highlighting.html"],
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_rainbow_highlighting() {
|
|
||||||
check_highlighting(
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
let hello = "hello";
|
|
||||||
let x = hello.to_string();
|
|
||||||
let y = hello.to_string();
|
|
||||||
|
|
||||||
let x = "other color please!";
|
|
||||||
let y = x.to_string();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn bar() {
|
|
||||||
let mut hello = "hello";
|
|
||||||
}
|
|
||||||
"#
|
|
||||||
.trim(),
|
|
||||||
expect_file!["./test_data/rainbow_highlighting.html"],
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn benchmark_syntax_highlighting_long_struct() {
|
|
||||||
if skip_slow_tests() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let fixture = bench_fixture::big_struct();
|
|
||||||
let (analysis, file_id) = fixture::file(&fixture);
|
|
||||||
|
|
||||||
let hash = {
|
|
||||||
let _pt = bench("syntax highlighting long struct");
|
|
||||||
analysis
|
|
||||||
.highlight(file_id)
|
|
||||||
.unwrap()
|
|
||||||
.iter()
|
|
||||||
.filter(|it| it.highlight.tag == HlTag::Symbol(SymbolKind::Struct))
|
|
||||||
.count()
|
|
||||||
};
|
|
||||||
assert_eq!(hash, 2001);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn syntax_highlighting_not_quadratic() {
|
|
||||||
if skip_slow_tests() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut al = AssertLinear::default();
|
|
||||||
while al.next_round() {
|
|
||||||
for i in 6..=10 {
|
|
||||||
let n = 1 << i;
|
|
||||||
|
|
||||||
let fixture = bench_fixture::big_struct_n(n);
|
|
||||||
let (analysis, file_id) = fixture::file(&fixture);
|
|
||||||
|
|
||||||
let time = Instant::now();
|
|
||||||
|
|
||||||
let hash = analysis
|
|
||||||
.highlight(file_id)
|
|
||||||
.unwrap()
|
|
||||||
.iter()
|
|
||||||
.filter(|it| it.highlight.tag == HlTag::Symbol(SymbolKind::Struct))
|
|
||||||
.count();
|
|
||||||
assert!(hash > n as usize);
|
|
||||||
|
|
||||||
let elapsed = time.elapsed();
|
|
||||||
al.sample(n as f64, elapsed.as_millis() as f64);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn benchmark_syntax_highlighting_parser() {
|
|
||||||
if skip_slow_tests() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let fixture = bench_fixture::glorious_old_parser();
|
|
||||||
let (analysis, file_id) = fixture::file(&fixture);
|
|
||||||
|
|
||||||
let hash = {
|
|
||||||
let _pt = bench("syntax highlighting parser");
|
|
||||||
analysis
|
|
||||||
.highlight(file_id)
|
|
||||||
.unwrap()
|
|
||||||
.iter()
|
|
||||||
.filter(|it| it.highlight.tag == HlTag::Symbol(SymbolKind::Function))
|
|
||||||
.count()
|
|
||||||
};
|
|
||||||
assert_eq!(hash, 1616);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_ranges() {
|
|
||||||
let (analysis, file_id) = fixture::file(
|
|
||||||
r#"
|
|
||||||
#[derive(Clone, Debug)]
|
|
||||||
struct Foo {
|
|
||||||
pub x: i32,
|
|
||||||
pub y: i32,
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
);
|
|
||||||
|
|
||||||
// The "x"
|
|
||||||
let highlights = &analysis
|
|
||||||
.highlight_range(FileRange { file_id, range: TextRange::at(45.into(), 1.into()) })
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
assert_eq!(&highlights[0].highlight.to_string(), "field.declaration.public");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_flattening() {
|
|
||||||
check_highlighting(
|
|
||||||
r##"
|
|
||||||
fn fixture(ra_fixture: &str) {}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
fixture(r#"
|
|
||||||
trait Foo {
|
|
||||||
fn foo() {
|
|
||||||
println!("2 + 2 = {}", 4);
|
|
||||||
}
|
|
||||||
}"#
|
|
||||||
);
|
|
||||||
}"##
|
|
||||||
.trim(),
|
|
||||||
expect_file!["./test_data/highlight_injection.html"],
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn ranges_sorted() {
|
|
||||||
let (analysis, file_id) = fixture::file(
|
|
||||||
r#"
|
|
||||||
#[foo(bar = "bar")]
|
|
||||||
macro_rules! test {}
|
|
||||||
}"#
|
|
||||||
.trim(),
|
|
||||||
);
|
|
||||||
let _ = analysis.highlight(file_id).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_string_highlighting() {
|
fn test_string_highlighting() {
|
||||||
// The format string detection is based on macro-expansion,
|
// The format string detection is based on macro-expansion,
|
||||||
|
@ -555,8 +406,7 @@ fn main() {
|
||||||
toho!("{}fmt", 0);
|
toho!("{}fmt", 0);
|
||||||
asm!("mov eax, {0}");
|
asm!("mov eax, {0}");
|
||||||
format_args!(concat!("{}"), "{}");
|
format_args!(concat!("{}"), "{}");
|
||||||
}"#
|
}"#,
|
||||||
.trim(),
|
|
||||||
expect_file!["./test_data/highlight_strings.html"],
|
expect_file!["./test_data/highlight_strings.html"],
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
@ -630,8 +480,7 @@ fn main() {
|
||||||
packed.a.calls_autoref();
|
packed.a.calls_autoref();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"#
|
"#,
|
||||||
.trim(),
|
|
||||||
expect_file!["./test_data/highlight_unsafe.html"],
|
expect_file!["./test_data/highlight_unsafe.html"],
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
@ -781,8 +630,7 @@ pub fn block_comments2() {}
|
||||||
//! ```
|
//! ```
|
||||||
//! fn test() {}
|
//! fn test() {}
|
||||||
//! ```
|
//! ```
|
||||||
"#
|
"#,
|
||||||
.trim(),
|
|
||||||
expect_file!["./test_data/highlight_doctest.html"],
|
expect_file!["./test_data/highlight_doctest.html"],
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
@ -792,14 +640,14 @@ pub fn block_comments2() {}
|
||||||
fn test_extern_crate() {
|
fn test_extern_crate() {
|
||||||
check_highlighting(
|
check_highlighting(
|
||||||
r#"
|
r#"
|
||||||
//- /main.rs crate:main deps:std,alloc
|
//- /main.rs crate:main deps:std,alloc
|
||||||
extern crate std;
|
extern crate std;
|
||||||
extern crate alloc as abc;
|
extern crate alloc as abc;
|
||||||
//- /std/lib.rs crate:std
|
//- /std/lib.rs crate:std
|
||||||
pub struct S;
|
pub struct S;
|
||||||
//- /alloc/lib.rs crate:alloc
|
//- /alloc/lib.rs crate:alloc
|
||||||
pub struct A
|
pub struct A
|
||||||
"#,
|
"#,
|
||||||
expect_file!["./test_data/highlight_extern_crate.html"],
|
expect_file!["./test_data/highlight_extern_crate.html"],
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
@ -809,20 +657,20 @@ fn test_extern_crate() {
|
||||||
fn test_crate_root() {
|
fn test_crate_root() {
|
||||||
check_highlighting(
|
check_highlighting(
|
||||||
r#"
|
r#"
|
||||||
//- minicore: iterators
|
//- minicore: iterators
|
||||||
//- /main.rs crate:main deps:foo
|
//- /main.rs crate:main deps:foo
|
||||||
extern crate foo;
|
extern crate foo;
|
||||||
use core::iter;
|
use core::iter;
|
||||||
|
|
||||||
pub const NINETY_TWO: u8 = 92;
|
pub const NINETY_TWO: u8 = 92;
|
||||||
|
|
||||||
use foo as foooo;
|
use foo as foooo;
|
||||||
|
|
||||||
pub(crate) fn main() {
|
pub(crate) fn main() {
|
||||||
let baz = iter::repeat(92);
|
let baz = iter::repeat(92);
|
||||||
}
|
}
|
||||||
|
|
||||||
mod bar {
|
mod bar {
|
||||||
pub(in super) const FORTY_TWO: u8 = 42;
|
pub(in super) const FORTY_TWO: u8 = 42;
|
||||||
|
|
||||||
mod baz {
|
mod baz {
|
||||||
|
@ -831,19 +679,19 @@ fn test_crate_root() {
|
||||||
|
|
||||||
pub(in super::super) const TWENTY_NINE: u8 = 29;
|
pub(in super::super) const TWENTY_NINE: u8 = 29;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//- /foo.rs crate:foo
|
//- /foo.rs crate:foo
|
||||||
struct Point {
|
struct Point {
|
||||||
x: u8,
|
x: u8,
|
||||||
y: u8,
|
y: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
mod inner {
|
mod inner {
|
||||||
pub(super) fn swap(p: crate::Point) -> crate::Point {
|
pub(super) fn swap(p: crate::Point) -> crate::Point {
|
||||||
crate::Point { x: p.y, y: p.x }
|
crate::Point { x: p.y, y: p.x }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
expect_file!["./test_data/highlight_crate_root.html"],
|
expect_file!["./test_data/highlight_crate_root.html"],
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
@ -853,14 +701,14 @@ fn test_crate_root() {
|
||||||
fn test_default_library() {
|
fn test_default_library() {
|
||||||
check_highlighting(
|
check_highlighting(
|
||||||
r#"
|
r#"
|
||||||
//- minicore: option, iterators
|
//- minicore: option, iterators
|
||||||
use core::iter;
|
use core::iter;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let foo = Some(92);
|
let foo = Some(92);
|
||||||
let nums = iter::repeat(foo.unwrap());
|
let nums = iter::repeat(foo.unwrap());
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
expect_file!["./test_data/highlight_default_library.html"],
|
expect_file!["./test_data/highlight_default_library.html"],
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
@ -888,7 +736,7 @@ impl t for foo {
|
||||||
pub fn is_static() {}
|
pub fn is_static() {}
|
||||||
pub fn is_not_static(&self) {}
|
pub fn is_not_static(&self) {}
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
expect_file!["./test_data/highlight_assoc_functions.html"],
|
expect_file!["./test_data/highlight_assoc_functions.html"],
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
|
@ -907,17 +755,163 @@ fn foo() {
|
||||||
}\$0)
|
}\$0)
|
||||||
}");
|
}");
|
||||||
}
|
}
|
||||||
"##,
|
"##,
|
||||||
expect_file!["./test_data/injection.html"],
|
expect_file!["./test_data/injection.html"],
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_rainbow_highlighting() {
|
||||||
|
check_highlighting(
|
||||||
|
r#"
|
||||||
|
fn main() {
|
||||||
|
let hello = "hello";
|
||||||
|
let x = hello.to_string();
|
||||||
|
let y = hello.to_string();
|
||||||
|
|
||||||
|
let x = "other color please!";
|
||||||
|
let y = x.to_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bar() {
|
||||||
|
let mut hello = "hello";
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
expect_file!["./test_data/rainbow_highlighting.html"],
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_ranges() {
|
||||||
|
let (analysis, file_id) = fixture::file(
|
||||||
|
r#"
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
struct Foo {
|
||||||
|
pub x: i32,
|
||||||
|
pub y: i32,
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
|
||||||
|
// The "x"
|
||||||
|
let highlights = &analysis
|
||||||
|
.highlight_range(FileRange { file_id, range: TextRange::at(45.into(), 1.into()) })
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(&highlights[0].highlight.to_string(), "field.declaration.public");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_flattening() {
|
||||||
|
check_highlighting(
|
||||||
|
r##"
|
||||||
|
fn fixture(ra_fixture: &str) {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
fixture(r#"
|
||||||
|
trait Foo {
|
||||||
|
fn foo() {
|
||||||
|
println!("2 + 2 = {}", 4);
|
||||||
|
}
|
||||||
|
}"#
|
||||||
|
);
|
||||||
|
}"##,
|
||||||
|
expect_file!["./test_data/highlight_injection.html"],
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn ranges_sorted() {
|
||||||
|
let (analysis, file_id) = fixture::file(
|
||||||
|
r#"
|
||||||
|
#[foo(bar = "bar")]
|
||||||
|
macro_rules! test {}
|
||||||
|
}"#
|
||||||
|
.trim(),
|
||||||
|
);
|
||||||
|
let _ = analysis.highlight(file_id).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
/// Highlights the code given by the `ra_fixture` argument, renders the
|
/// Highlights the code given by the `ra_fixture` argument, renders the
|
||||||
/// result as HTML, and compares it with the HTML file given as `snapshot`.
|
/// result as HTML, and compares it with the HTML file given as `snapshot`.
|
||||||
/// Note that the `snapshot` file is overwritten by the rendered HTML.
|
/// Note that the `snapshot` file is overwritten by the rendered HTML.
|
||||||
fn check_highlighting(ra_fixture: &str, expect: ExpectFile, rainbow: bool) {
|
fn check_highlighting(ra_fixture: &str, expect: ExpectFile, rainbow: bool) {
|
||||||
let (analysis, file_id) = fixture::file(ra_fixture);
|
let (analysis, file_id) = fixture::file(ra_fixture.trim());
|
||||||
let actual_html = &analysis.highlight_as_html(file_id, rainbow).unwrap();
|
let actual_html = &analysis.highlight_as_html(file_id, rainbow).unwrap();
|
||||||
expect.assert_eq(actual_html)
|
expect.assert_eq(actual_html)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn benchmark_syntax_highlighting_long_struct() {
|
||||||
|
if skip_slow_tests() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let fixture = bench_fixture::big_struct();
|
||||||
|
let (analysis, file_id) = fixture::file(&fixture);
|
||||||
|
|
||||||
|
let hash = {
|
||||||
|
let _pt = bench("syntax highlighting long struct");
|
||||||
|
analysis
|
||||||
|
.highlight(file_id)
|
||||||
|
.unwrap()
|
||||||
|
.iter()
|
||||||
|
.filter(|it| it.highlight.tag == HlTag::Symbol(SymbolKind::Struct))
|
||||||
|
.count()
|
||||||
|
};
|
||||||
|
assert_eq!(hash, 2001);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn syntax_highlighting_not_quadratic() {
|
||||||
|
if skip_slow_tests() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut al = AssertLinear::default();
|
||||||
|
while al.next_round() {
|
||||||
|
for i in 6..=10 {
|
||||||
|
let n = 1 << i;
|
||||||
|
|
||||||
|
let fixture = bench_fixture::big_struct_n(n);
|
||||||
|
let (analysis, file_id) = fixture::file(&fixture);
|
||||||
|
|
||||||
|
let time = Instant::now();
|
||||||
|
|
||||||
|
let hash = analysis
|
||||||
|
.highlight(file_id)
|
||||||
|
.unwrap()
|
||||||
|
.iter()
|
||||||
|
.filter(|it| it.highlight.tag == HlTag::Symbol(SymbolKind::Struct))
|
||||||
|
.count();
|
||||||
|
assert!(hash > n as usize);
|
||||||
|
|
||||||
|
let elapsed = time.elapsed();
|
||||||
|
al.sample(n as f64, elapsed.as_millis() as f64);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn benchmark_syntax_highlighting_parser() {
|
||||||
|
if skip_slow_tests() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let fixture = bench_fixture::glorious_old_parser();
|
||||||
|
let (analysis, file_id) = fixture::file(&fixture);
|
||||||
|
|
||||||
|
let hash = {
|
||||||
|
let _pt = bench("syntax highlighting parser");
|
||||||
|
analysis
|
||||||
|
.highlight(file_id)
|
||||||
|
.unwrap()
|
||||||
|
.iter()
|
||||||
|
.filter(|it| it.highlight.tag == HlTag::Symbol(SymbolKind::Function))
|
||||||
|
.count()
|
||||||
|
};
|
||||||
|
assert_eq!(hash, 1616);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue