diff options
author | Martin Fischer <martin@push-f.com> | 2023-08-30 08:36:32 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2023-09-03 23:00:05 +0200 |
commit | ac338b77b658f0a3a645c96110320f8a9ae7f0ee (patch) | |
tree | 1b6af7075f92b2e761b82e41238dcfa6ed3a2d8a /tests/test_spans.rs | |
parent | 5d91c0cca7e8f453e0e2f36c57e9ad85ee8ab124 (diff) |
test: verify too small char ref error spans
Diffstat (limited to 'tests/test_spans.rs')
-rw-r--r-- | tests/test_spans.rs | 54 |
1 files changed, 54 insertions, 0 deletions
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 @@ -245,6 +245,24 @@ fn tests_for_errors_are_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 = "¬"; assert_snapshot!(annotate_errors(html), @r###" @@ -254,6 +272,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;"; assert_snapshot!(annotate_errors(html), @r###" |