mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
parent
edf4347a5a
commit
5a1ef42369
1 changed files with 13 additions and 0 deletions
|
@ -146,6 +146,9 @@ impl PartialEq for Element {
|
|||
fn eq(&self, other: &Self) -> bool {
|
||||
if self.name() == other.name() && self.ns() == other.ns() && self.attrs().eq(other.attrs())
|
||||
{
|
||||
if self.nodes().count() != other.nodes().count() {
|
||||
return false;
|
||||
}
|
||||
self.nodes()
|
||||
.zip(other.nodes())
|
||||
.all(|(node1, node2)| node1 == node2)
|
||||
|
@ -978,6 +981,16 @@ mod tests {
|
|||
assert_eq!(elem, elem4);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_compare_empty_children() {
|
||||
let elem1 = Element::bare("p", "");
|
||||
let elem2 = Element::builder("p", "")
|
||||
.append(Node::Element(Element::bare("span", "")))
|
||||
.build();
|
||||
|
||||
assert_ne!(elem1, elem2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_reader_with_prefixes() {
|
||||
let xml = b"<foo><bar xmlns='baz'/></foo>";
|
||||
|
|
Loading…
Reference in a new issue