editor: add plain language with no grammar

This commit is contained in:
2026-11-11 09:41:56 +07:00
parent 63ed15c9cb
commit 65509ccde1
3 changed files with 19 additions and 1 deletions
+15
View File
@@ -42,6 +42,21 @@ fn a_rust_snippet_gets_its_roles_from_the_grammar() {
);
}
#[test]
fn plain_language_never_applies_grammar_roles() {
let source = "// a comment\nfn main() {\n let greeting = \"hello\";\n}\n";
let code = highlight(source, Language::Plain);
assert_eq!(code.lines.len(), 5, "a trailing newline ends an empty line");
assert!(
code.lines
.iter()
.flat_map(|line| line.spans.iter())
.all(|span| span.role == Role::Text),
"plain renders every span as text, whatever the source looks like"
);
}
#[test]
fn a_capture_spanning_newlines_styles_both_lines() {
let source = "let text = \"a\nb\";\n";