aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-08-30 07:29:23 +0200
committerMartin Fischer <martin@push-f.com>2023-09-03 23:00:05 +0200
commita3f0d87fe4f4c21e09b981ffa72535fcdf9a78ae (patch)
treea559c8bcec58274a5f9f43e04f9c248998c93480 /tests
parentc38810192fbf11007f53bcccd48072e099a4191a (diff)
test: add span tests for eof errors
Diffstat (limited to 'tests')
-rw-r--r--tests/test_spans.rs48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/test_spans.rs b/tests/test_spans.rs
index 8f3dc8f..840e8e1 100644
--- a/tests/test_spans.rs
+++ b/tests/test_spans.rs
@@ -261,6 +261,54 @@ fn error_end_tag_with_trailing_solidus() {
}
#[test]
+fn error_eof_before_tag_name() {
+ let html = "<";
+ assert_snapshot!(annotate_errors(html), @r###"
+ <
+ ^ eof-before-tag-name
+ "###);
+}
+
+// TODO: add error_eof_in_cdata test
+// blocked by lack of proper tree constructor (NaiveParser doesn't parse CDATA sections)
+
+#[test]
+fn error_eof_in_comment() {
+ let html = "<!--";
+ assert_snapshot!(annotate_errors(html), @r###"
+ <!--
+ ^ eof-in-comment
+ "###);
+}
+
+#[test]
+fn error_eof_in_doctype() {
+ let html = "<!doctype html";
+ assert_snapshot!(annotate_errors(html), @r###"
+ <!doctype html
+ ^ eof-in-doctype
+ "###);
+}
+
+#[test]
+fn error_eof_in_script_html_comment_like_text() {
+ let html = "<script><!--";
+ assert_snapshot!(annotate_errors(html), @r###"
+ <script><!--
+ ^ eof-in-script-html-comment-like-text
+ "###);
+}
+
+#[test]
+fn error_eof_in_tag() {
+ let html = "</sarcasm";
+ assert_snapshot!(annotate_errors(html), @r###"
+ </sarcasm
+ ^ eof-in-tag
+ "###);
+}
+
+#[test]
fn error_invalid_first_character_of_tag_name() {
let html = "Please mind the gap: < test";
assert_snapshot!(annotate_errors(html), @r###"