aboutsummaryrefslogtreecommitdiff
path: root/tests/test_spans.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-08-16 09:45:18 +0200
committerMartin Fischer <martin@push-f.com>2023-08-19 13:41:55 +0200
commit65aca9cbf0318bd3a2f936641b4f5bc3729c98c2 (patch)
tree3bf6ae3ea03c1f377e9b4bd6fd7d6af99fbddc5a /tests/test_spans.rs
parent0f460c2e77f450a2bac68eec97b2c62aa33c0495 (diff)
break!: introduce AttributeMap
This has a number of benefits: * it hides the implementation of the map * it hides the type used for the map values (which lets us e.g. change name_span to name_offset while still being able to provide a convenient `Attribute::name_span` method.) * it lets us provide convenience impls for the map such as `FromIterator<(String, String)>`
Diffstat (limited to 'tests/test_spans.rs')
-rw-r--r--tests/test_spans.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/test_spans.rs b/tests/test_spans.rs
index 33f5d11..99ff9ee 100644
--- a/tests/test_spans.rs
+++ b/tests/test_spans.rs
@@ -110,8 +110,8 @@ fn attribute_name_span() {
let Token::StartTag(tag) = tokenizer(html).next().unwrap() else {
panic!("expected start tag")
};
- for (_name, attr) in tag.attributes {
- labels.push((attr.name_span, ""));
+ for attr in &tag.attributes {
+ labels.push((attr.name_span(), ""));
}
assert_snapshot!(annotate(html, labels), @r###"
<test x xyz y=VAL xy=VAL z = VAL yzx = VAL>
@@ -126,8 +126,8 @@ fn attribute_value_span() {
let Token::StartTag(tag) = tokenizer(html).next().unwrap() else {
panic!("expected start tag")
};
- for (_name, attr) in tag.attributes {
- labels.push((attr.value_span, ""));
+ for attr in &tag.attributes {
+ labels.push((attr.value_span(), ""));
}
assert_snapshot!(annotate(html, labels), @r###"
<test x=unquoted y = unquoted z='single-quoted' zz="double-quoted" empty=''>