aboutsummaryrefslogtreecommitdiff
path: root/tests/test_spans.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-09-15 08:15:29 +0200
committerMartin Fischer <martin@push-f.com>2023-09-28 10:36:08 +0200
commite0434737b20b32a8d7238a134c3662fa9075eb6d (patch)
tree8fbfc1fa768fead46a425a1c51970338517ed695 /tests/test_spans.rs
parentd913e6e91e43241b0105afbbad7db5c5bcda0255 (diff)
feat: add offset to Trace::EndOfFile
Diffstat (limited to 'tests/test_spans.rs')
-rw-r--r--tests/test_spans.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_spans.rs b/tests/test_spans.rs
index 0e95be0..d19d6aa 100644
--- a/tests/test_spans.rs
+++ b/tests/test_spans.rs
@@ -351,6 +351,24 @@ fn doctype_id_spans() {
"###);
}
+#[test]
+fn eof_offset() {
+ let html = "Where does it end?";
+ let labeler = |parser: Parser| {
+ let mut labels = Vec::new();
+ for (_, trace) in parser.flatten() {
+ if let Trace::EndOfFile(offset) = trace {
+ labels.push((offset..offset, "here"));
+ }
+ }
+ labels
+ };
+ assert_snapshot!(test_and_annotate(html, labeler), @r###"
+ Where does it end?
+ ^ here
+ "###);
+}
+
fn annotate_errors(html: &'static str) -> String {
let mut parser = parser(html);
for _ in parser.by_ref() {}