aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-09-15 09:40:55 +0200
committerMartin Fischer <martin@push-f.com>2023-09-28 10:36:08 +0200
commitd46de6ab592e57a31fef13cfc015c4ce818e8f47 (patch)
tree814654b579f0a1754193a40786f09a711adc021a /tests
parent2e986862920b438b253fd6e6f11d8f4e5d6f4e27 (diff)
feat: add span to Trace::Char
Diffstat (limited to 'tests')
-rw-r--r--tests/test_spans.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_spans.rs b/tests/test_spans.rs
index d19d6aa..b10808c 100644
--- a/tests/test_spans.rs
+++ b/tests/test_spans.rs
@@ -73,6 +73,26 @@ fn annotate(html: &str, labels: Vec<(Range<usize>, impl AsRef<str>)>) -> String
}
#[test]
+fn char_span() {
+ let html = "X &amp; &doesntexist; &#1123; </";
+ let labeler = |parser: Parser| {
+ let mut labels = Vec::new();
+ for token_trace in parser.flatten() {
+ if let (Token::Char(c), Trace::Char(span)) = token_trace {
+ if c != ' ' {
+ labels.push((span, ""));
+ }
+ }
+ }
+ labels
+ };
+ assert_snapshot!(test_and_annotate(html, labeler), @r###"
+ X &amp; &doesntexist; &#1123; </
+ ^ ^^^^^ ^^^^^^^^^^^^^ ^^^^^^^ ^^
+ "###);
+}
+
+#[test]
fn start_tag_span() {
let html = "<x> <xyz> <xyz > <xyz/>";
let labeler = |parser: Parser| {