aboutsummaryrefslogtreecommitdiff
path: root/tests/test_spans.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-08-31 04:36:59 +0200
committerMartin Fischer <martin@push-f.com>2023-09-03 23:00:05 +0200
commit6763f3564a4640130e297c1f775e2c77f03dae89 (patch)
treeb029c08daf1823b9d359ddcc77a2d1ff41299463 /tests/test_spans.rs
parent6f593fffaef3d1f539dd899579784c89182602b6 (diff)
test: verify wrong attribute value spans for char refs
Diffstat (limited to 'tests/test_spans.rs')
-rw-r--r--tests/test_spans.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_spans.rs b/tests/test_spans.rs
index d3e62ae..bc6aeee 100644
--- a/tests/test_spans.rs
+++ b/tests/test_spans.rs
@@ -132,6 +132,22 @@ fn attribute_value_span() {
}
#[test]
+fn attribute_value_with_char_ref() {
+ let html = "<test x=&amp; y='&amp;' z=\"&amp;\">";
+ let mut labels = Vec::new();
+ let Token::StartTag(tag) = tokenizer(html).next().unwrap() else {
+ panic!("expected start tag")
+ };
+ for attr in &tag.attributes {
+ labels.push((attr.value_span().unwrap(), ""));
+ }
+ assert_snapshot!(annotate(html, labels), @r###"
+ <test x=&amp; y='&amp;' z="&amp;">
+ ^ ^ ^
+ "###);
+}
+
+#[test]
fn comment_proper_data_span() {
let html = "<!-- Why are you looking at the source code? -->";
let Token::Comment(comment) = tokenizer(html).next().unwrap() else {