diff --git a/src/tests.rs b/src/tests.rs
index 6dd6a2ba..40558eca 100644
--- a/src/tests.rs
+++ b/src/tests.rs
@@ -149,3 +149,50 @@ fn wrongly_closed_elements_error() {
let elem1 = "".parse::();
assert!(elem1.is_ok());
}
+
+#[test]
+fn namespace_simple() {
+ let elem: Element = "".parse().unwrap();
+ assert_eq!(elem.name(), "message");
+ assert_eq!(elem.ns(), Some("jabber:client"));
+}
+
+#[test]
+fn namespace_prefixed() {
+ let elem: Element = ""
+ .parse().unwrap();
+ assert_eq!(elem.name(), "features");
+ assert_eq!(elem.ns(), Some("http://etherx.jabber.org/streams"));
+}
+
+#[test]
+fn namespace_inherited_simple() {
+ let elem: Element = "".parse().unwrap();
+ assert_eq!(elem.name(), "stream");
+ assert_eq!(elem.ns(), Some("jabber:client"));
+ let child = elem.children().next().unwrap();
+ assert_eq!(child.name(), "message");
+ assert_eq!(child.ns(), Some("jabber:client"));
+}
+
+#[test]
+fn namespace_inherited_prefixed1() {
+ let elem: Element = ""
+ .parse().unwrap();
+ assert_eq!(elem.name(), "features");
+ assert_eq!(elem.ns(), Some("http://etherx.jabber.org/streams"));
+ let child = elem.children().next().unwrap();
+ assert_eq!(child.name(), "message");
+ assert_eq!(child.ns(), Some("jabber:client"));
+}
+
+#[test]
+fn namespace_inherited_prefixed2() {
+ let elem: Element = ""
+ .parse().unwrap();
+ assert_eq!(elem.name(), "stream");
+ assert_eq!(elem.ns(), Some("http://etherx.jabber.org/streams"));
+ let child = elem.children().next().unwrap();
+ assert_eq!(child.name(), "message");
+ assert_eq!(child.ns(), Some("jabber:client"));
+}