editor: add plain language with no grammar
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user