minidom: Implement PartialEq manually for Node and Element
Move the NamespaceAwareCompare implementation from xmpp-parsers as Node and Element's PartialEq implementation. Thanks Astro! It's a lot more useful in tests to use `assert_eq!` than `assert!`, so we get both items compared (left and right) instead of a "it failed." message. This "breaks" comparison for these two structs in the sense that it is not strict object comparison anymore but it ensures that namespaces are all present in the compared objects. Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
ea6e7c24a3
commit
1c5551a917
20 changed files with 65 additions and 172 deletions
|
|
@ -220,7 +220,6 @@ mod tests {
|
|||
use super::*;
|
||||
use crate::disco::DiscoInfoQuery;
|
||||
use crate::stanza_error::{DefinedCondition, ErrorType};
|
||||
use crate::util::compare_elements::NamespaceAwareCompare;
|
||||
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
#[test]
|
||||
|
|
@ -283,7 +282,7 @@ mod tests {
|
|||
assert_eq!(iq.to, None);
|
||||
assert_eq!(&iq.id, "foo");
|
||||
assert!(match iq.payload {
|
||||
IqType::Get(element) => element.compare_to(&query),
|
||||
IqType::Get(element) => element == query,
|
||||
_ => false,
|
||||
});
|
||||
}
|
||||
|
|
@ -308,7 +307,7 @@ mod tests {
|
|||
assert_eq!(iq.to, None);
|
||||
assert_eq!(&iq.id, "vcard");
|
||||
assert!(match iq.payload {
|
||||
IqType::Set(element) => element.compare_to(&vcard),
|
||||
IqType::Set(element) => element == vcard,
|
||||
_ => false,
|
||||
});
|
||||
}
|
||||
|
|
@ -355,7 +354,7 @@ mod tests {
|
|||
assert_eq!(iq.to, None);
|
||||
assert_eq!(&iq.id, "res");
|
||||
assert!(match iq.payload {
|
||||
IqType::Result(Some(element)) => element.compare_to(&query),
|
||||
IqType::Result(Some(element)) => element == query,
|
||||
_ => false,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue