test(lsp): add hemplate highlighting fixture
Add repo-owned hemplate highlighting fixture and golden capture contract without editor packaging or a second parser. req: diagnostics/004 req: diagnostics/008
This commit is contained in:
@@ -903,6 +903,44 @@ mod tests {
|
||||
assert!(value.contains("docs/hemplate-syntax.md"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hemplate_highlighting_fixture_covers_documented_overlay_tokens() {
|
||||
// req: diagnostics/004 req: diagnostics/008
|
||||
let fixture = include_str!("../../docs/fixtures/hemplate-highlighting/hemplate.heml");
|
||||
let captures = include_str!("../../docs/fixtures/hemplate-highlighting/captures.tsv");
|
||||
let allowed_captures = [
|
||||
"@attribute.hemx",
|
||||
"@attribute.dynamic.hemplate",
|
||||
"@keyword.control.hemplate",
|
||||
"@punctuation.special.hemplate.escaped.open",
|
||||
"@punctuation.special.hemplate.escaped.close",
|
||||
"@punctuation.special.hemplate.trusted.open",
|
||||
"@punctuation.special.hemplate.trusted.close",
|
||||
"@embedded.rust.hemplate",
|
||||
]
|
||||
.into_iter()
|
||||
.collect::<std::collections::BTreeSet<_>>();
|
||||
let mut seen = std::collections::BTreeSet::new();
|
||||
for (index, line) in captures.lines().enumerate().skip(1) {
|
||||
let (capture, literal) = line
|
||||
.split_once('\t')
|
||||
.unwrap_or_else(|| panic!("capture row {index} must be TSV"));
|
||||
assert!(
|
||||
allowed_captures.contains(capture),
|
||||
"unexpected capture `{capture}` in row {index}"
|
||||
);
|
||||
assert!(
|
||||
fixture.contains(literal),
|
||||
"highlight fixture missing literal `{literal}` for capture `{capture}`"
|
||||
);
|
||||
seen.insert(capture);
|
||||
}
|
||||
assert_eq!(
|
||||
seen, allowed_captures,
|
||||
"highlight fixture should exercise every documented overlay capture class"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn workout_template_fields_are_available_from_repo_facts() {
|
||||
// req: diagnostics/006
|
||||
|
||||
Reference in New Issue
Block a user