diff options
author | Martin Fischer <martin@push-f.com> | 2023-08-31 04:36:59 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2023-09-03 23:00:05 +0200 |
commit | 6763f3564a4640130e297c1f775e2c77f03dae89 (patch) | |
tree | b029c08daf1823b9d359ddcc77a2d1ff41299463 /tests | |
parent | 6f593fffaef3d1f539dd899579784c89182602b6 (diff) |
test: verify wrong attribute value spans for char refs
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_spans.rs | 16 |
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=& y='&' z=\"&\">"; + 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=& y='&' z="&"> + ^ ^ ^ + "###); +} + +#[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 { |