From ac338b77b658f0a3a645c96110320f8a9ae7f0ee Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Wed, 30 Aug 2023 08:36:32 +0200 Subject: test: verify too small char ref error spans --- tests/test_spans.rs | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'tests') diff --git a/tests/test_spans.rs b/tests/test_spans.rs index 0956f8e..f22a2aa 100644 --- a/tests/test_spans.rs +++ b/tests/test_spans.rs @@ -244,6 +244,24 @@ fn tests_for_errors_are_sorted() { assert_eq!(error_tests_found_order, error_tests_sorted); } +#[test] +fn error_char_ref_absence_of_digits() { + let html = "&#qux;"; + assert_snapshot!(annotate_errors(html), @r###" + &#qux; + ^ absence-of-digits-in-numeric-character-reference + "###); +} + +#[test] +fn error_char_ref_control_char() { + let html = ""; + assert_snapshot!(annotate_errors(html), @r###" +  + ^ control-character-reference + "###); +} + #[test] fn error_char_ref_missing_semicolon() { let html = "¬"; @@ -253,6 +271,42 @@ fn error_char_ref_missing_semicolon() { "###); } +#[test] +fn error_char_ref_noncharacter() { + let html = "﷐"; + assert_snapshot!(annotate_errors(html), @r###" + ﷐ + ^ noncharacter-character-reference + "###); +} + +#[test] +fn error_char_ref_null_char() { + let html = "�"; + assert_snapshot!(annotate_errors(html), @r###" + � + ^ null-character-reference + "###); +} + +#[test] +fn error_char_ref_outside_unicode_range() { + let html = "�"; + assert_snapshot!(annotate_errors(html), @r###" + � + ^ character-reference-outside-unicode-range + "###); +} + +#[test] +fn error_char_ref_surrogate() { + let html = "�"; + assert_snapshot!(annotate_errors(html), @r###" + � + ^ surrogate-character-reference + "###); +} + #[test] fn error_char_ref_unknown_named() { let html = "The pirate says &arrrrr;"; -- cgit v1.2.3