You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[test]
fn test_classed_html_generator_panics() {
let current_code = "{\n \"headers\": [\"Number\", \"Title\"],\n \"records\": [\n [\"1\", \"Gutenberg\"],\n [\"2\", \"Printing\"]\n ],\n}\n";
let syntax_set = SyntaxSet::load_defaults_newlines();
let syntax = syntax_set.find_syntax_by_token("json").unwrap();
println!("{:?}", syntax);
let mut html_generator = ClassedHTMLGenerator::new_with_class_style(&syntax, &syntax_set, ClassStyle::Spaced);
for line in LinesWithEndings::from(current_code) {
html_generator.parse_html_for_line_which_includes_newline(&line);
}
let html = html_generator.finalize();
assert_eq!(html, "<span class=\"source r\">x <span class=\"keyword operator arithmetic r\">+</span> y\n</span>");
}
It will panic with:
thread 'html::tests::test_classed_html_generator_panics' panicked at 'tried to restore cleared scopes, but none were cleared', src/parsing/scope.rs:450:29
Making src/parsing/scope.rs:450:29 a no-op (() instead of panicking) fixes the issue and it seems highlighted correctly (?).
The text was updated successfully, but these errors were encountered:
To reproduce:
207cf862
It will panic with:
Making
src/parsing/scope.rs:450:29
a no-op (()
instead of panicking) fixes the issue and it seems highlighted correctly (?).The text was updated successfully, but these errors were encountered: