Implement scansion:any in attr
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
f5ac2d7ec6
commit
1f0a7e4e18
1 changed files with 14 additions and 0 deletions
|
@ -227,6 +227,10 @@ impl<'a> PartialEq<&Element> for ScanElement<'a> {
|
|||
};
|
||||
|
||||
for (attr, val) in self.elem.attrs() {
|
||||
if val == "{scansion:any}" {
|
||||
continue;
|
||||
}
|
||||
|
||||
match (attr, other.attr(attr)) {
|
||||
(attr, _) if attr == "scansion:strict" => continue,
|
||||
(_, None) => return false,
|
||||
|
@ -479,4 +483,14 @@ mod tests {
|
|||
|
||||
assert_ne!(scan1, &elem2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ignore_attr_val_success() {
|
||||
let elem1: Element = "<message scansion:strict='true' xmlns='jabber:client' id='{scansion:any}' />"
|
||||
.parse().unwrap();
|
||||
let elem2: Element = "<message xmlns='jabber:client' id='some-id' />".parse().unwrap();
|
||||
let scan1 = ScanElement::new(&elem1);
|
||||
|
||||
assert_eq!(scan1, &elem2);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue