Remove debug prints
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
2f082be1f6
commit
f5ac2d7ec6
1 changed files with 2 additions and 20 deletions
|
@ -77,7 +77,6 @@ impl ScanNode {
|
||||||
|
|
||||||
impl PartialEq<Node> for ScanNode {
|
impl PartialEq<Node> for ScanNode {
|
||||||
fn eq(&self, other: &Node) -> bool {
|
fn eq(&self, other: &Node) -> bool {
|
||||||
println!("PartialEq<Node> for ScanNode:\n{:?}\n{:?}", self, other);
|
|
||||||
match (&self.node, other) {
|
match (&self.node, other) {
|
||||||
(Node::Text(text1), Node::Text(text2)) => {
|
(Node::Text(text1), Node::Text(text2)) => {
|
||||||
text1 == text2
|
text1 == text2
|
||||||
|
@ -124,13 +123,10 @@ fn filter_whitespace_nodes(nodes: Vec<Node>) -> Vec<Node> {
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.fold((None::<NodeType>, vec![]), filter_nodes).1;
|
.fold((None::<NodeType>, vec![]), filter_nodes).1;
|
||||||
|
|
||||||
println!("filter_whitespace_nodes: {:?}", nodes);
|
|
||||||
// Don't remove possibly significant whitespace text leaves
|
// Don't remove possibly significant whitespace text leaves
|
||||||
if nodes.iter().count() == 1 {
|
if nodes.iter().count() == 1 {
|
||||||
println!("Count: 1");
|
|
||||||
nodes
|
nodes
|
||||||
} else {
|
} else {
|
||||||
println!("Count: plus");
|
|
||||||
nodes
|
nodes
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(rm_empty_text)
|
.filter(rm_empty_text)
|
||||||
|
@ -221,11 +217,6 @@ impl<'a> PartialEq<&Element> for ScanElement<'a> {
|
||||||
if self.elem.name() == other.name() &&
|
if self.elem.name() == other.name() &&
|
||||||
self_ns == other.ns() {
|
self_ns == other.ns() {
|
||||||
|
|
||||||
println!("FOO0: {{{}}}{}", self.elem.ns(), self.elem.name());
|
|
||||||
for attr in self.elem.attrs() {
|
|
||||||
println!("FOO1: attr: {:?}", attr);
|
|
||||||
}
|
|
||||||
|
|
||||||
let strict_attr = self.elem.attr("scansion:strict");
|
let strict_attr = self.elem.attr("scansion:strict");
|
||||||
|
|
||||||
// Force true if scansion:strict is set or if a tag isn't in the default ns.
|
// Force true if scansion:strict is set or if a tag isn't in the default ns.
|
||||||
|
@ -234,20 +225,17 @@ impl<'a> PartialEq<&Element> for ScanElement<'a> {
|
||||||
} else {
|
} else {
|
||||||
self_ns != DEFAULT_NS
|
self_ns != DEFAULT_NS
|
||||||
};
|
};
|
||||||
println!("FOO: Strict: {:?}", strict);
|
|
||||||
|
|
||||||
for (attr, val) in self.elem.attrs() {
|
for (attr, val) in self.elem.attrs() {
|
||||||
println!("FOO: Attr: {} / {}", attr, val);
|
|
||||||
match (attr, other.attr(attr)) {
|
match (attr, other.attr(attr)) {
|
||||||
(attr, _) if attr == "scansion:strict" => continue,
|
(attr, _) if attr == "scansion:strict" => continue,
|
||||||
(_, None) => return false,
|
(_, None) => return false,
|
||||||
(_, Some(oval)) if val != oval => return false,
|
(_, Some(oval)) if val != oval => return false,
|
||||||
foo => println!("FOO: {:?}", foo),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let onodes = other.nodes().cloned().collect::<Vec<_>>();
|
let onodes = other.nodes().cloned().collect::<Vec<_>>();
|
||||||
println!("FOO-2: foo2 {:?}", onodes);
|
|
||||||
|
|
||||||
// Compare attributes count
|
// Compare attributes count
|
||||||
if strict {
|
if strict {
|
||||||
|
@ -261,11 +249,9 @@ impl<'a> PartialEq<&Element> for ScanElement<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let nodes = ScanNodes::new_strict(self.elem.nodes().cloned().collect());
|
let nodes = ScanNodes::new_strict(self.elem.nodes().cloned().collect());
|
||||||
println!("FOO-1: foo1 {:?}", nodes);
|
|
||||||
nodes == onodes
|
nodes == onodes
|
||||||
} else {
|
} else {
|
||||||
let nodes = ScanNodes::<NonStrictComparison>::new(self.elem.nodes().cloned().collect());
|
let nodes = ScanNodes::new(self.elem.nodes().cloned().collect());
|
||||||
println!("FOO-1: foo1 {:?}", nodes);
|
|
||||||
nodes == onodes
|
nodes == onodes
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -361,11 +347,9 @@ mod tests {
|
||||||
let elem2: Element = "<presence scansion:strict='true' xmlns='jabber:client'>
|
let elem2: Element = "<presence scansion:strict='true' xmlns='jabber:client'>
|
||||||
<x xmlns='http://jabber.org/protocol/muc'/>
|
<x xmlns='http://jabber.org/protocol/muc'/>
|
||||||
</presence>".parse().unwrap();
|
</presence>".parse().unwrap();
|
||||||
println!("BAR0: {:?}", elem2);
|
|
||||||
let elem3: Element = "<presence xmlns='jabber:client'>
|
let elem3: Element = "<presence xmlns='jabber:client'>
|
||||||
<x xmlns='http://jabber.org/protocol/muc'/>
|
<x xmlns='http://jabber.org/protocol/muc'/>
|
||||||
</presence>".parse().unwrap();
|
</presence>".parse().unwrap();
|
||||||
println!("BAR1: {:?}", elem3);
|
|
||||||
let scan2 = ScanElement::new(&elem2);
|
let scan2 = ScanElement::new(&elem2);
|
||||||
|
|
||||||
assert_eq!(scan2, &elem3);
|
assert_eq!(scan2, &elem3);
|
||||||
|
@ -408,12 +392,10 @@ mod tests {
|
||||||
<photo/>
|
<photo/>
|
||||||
</x>
|
</x>
|
||||||
</presence>".parse().unwrap();
|
</presence>".parse().unwrap();
|
||||||
println!("BAR0: {:?}", elem1);
|
|
||||||
let elem2: Element = "<presence scansion:strict='true' xmlns='jabber:client'>
|
let elem2: Element = "<presence scansion:strict='true' xmlns='jabber:client'>
|
||||||
<x xmlns='http://jabber.org/protocol/muc' />
|
<x xmlns='http://jabber.org/protocol/muc' />
|
||||||
<x xmlns='vcard-temp:x:update'/>
|
<x xmlns='vcard-temp:x:update'/>
|
||||||
</presence>".parse().unwrap();
|
</presence>".parse().unwrap();
|
||||||
println!("BAR1: {:?}", elem2);
|
|
||||||
let scan1 = ScanElement::new(&elem1);
|
let scan1 = ScanElement::new(&elem1);
|
||||||
|
|
||||||
assert_ne!(scan1, &elem2);
|
assert_ne!(scan1, &elem2);
|
||||||
|
|
Loading…
Reference in a new issue