From 9a00c998ae153268509b0b3f5553d0b4d407e300 Mon Sep 17 00:00:00 2001 From: lumi Date: Sat, 25 Feb 2017 00:10:18 +0100 Subject: [PATCH] add a test for an issue with namespace propagation --- src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 5420df83efc3982d2038ad99c467d951b37ef889..c5f8f9abbaf2ff246a3e67f389a451d01df02d06 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -672,4 +672,15 @@ mod tests { assert_eq!(root.get_child("child", "root_ns").unwrap().attr("c"), Some("d")); assert_eq!(root.get_child("child", "child_ns").unwrap().attr("d"), Some("e")); } + + #[test] + fn namespace_propagation_works() { + let mut root = Element::builder("root").ns("root_ns").build(); + let mut child = Element::bare("child"); + let grandchild = Element::bare("grandchild"); + child.append_child(grandchild); + root.append_child(child); + assert_eq!(root.get_child("child", "root_ns").unwrap().ns(), root.ns()); + assert_eq!(root.get_child("grandchild", "root_ns").unwrap().ns(), root.ns()); + } }