summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-08-30 08:36:32 +0200
committerMartin Fischer <martin@push-f.com>2023-09-03 23:00:05 +0200
commitac338b77b658f0a3a645c96110320f8a9ae7f0ee (patch)
tree1b6af7075f92b2e761b82e41238dcfa6ed3a2d8a /tests
parent5d91c0cca7e8f453e0e2f36c57e9ad85ee8ab124 (diff)
test: verify too small char ref error spans
Diffstat (limited to 'tests')
-rw-r--r--tests/test_spans.rs54
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 = "&#127;";
+ assert_snapshot!(annotate_errors(html), @r###"
+ &#127;
+ ^ control-character-reference
+ "###);
+}
+
+#[test]
fn error_char_ref_missing_semicolon() {
let html = "&not";
assert_snapshot!(annotate_errors(html), @r###"
@@ -254,6 +272,42 @@ fn error_char_ref_missing_semicolon() {
}
#[test]
+fn error_char_ref_noncharacter() {
+ let html = "&#xFDD0;";
+ assert_snapshot!(annotate_errors(html), @r###"
+ &#xFDD0;
+ ^ noncharacter-character-reference
+ "###);
+}
+
+#[test]
+fn error_char_ref_null_char() {
+ let html = "&#0;";
+ assert_snapshot!(annotate_errors(html), @r###"
+ &#0;
+ ^ null-character-reference
+ "###);
+}
+
+#[test]
+fn error_char_ref_outside_unicode_range() {
+ let html = "&#9999999;";
+ assert_snapshot!(annotate_errors(html), @r###"
+ &#9999999;
+ ^ character-reference-outside-unicode-range
+ "###);
+}
+
+#[test]
+fn error_char_ref_surrogate() {
+ let html = "&#xD800;";
+ assert_snapshot!(annotate_errors(html), @r###"
+ &#xD800;
+ ^ surrogate-character-reference
+ "###);
+}
+
+#[test]
fn error_char_ref_unknown_named() {
let html = "The pirate says &arrrrr;";
assert_snapshot!(annotate_errors(html), @r###"