Add test for namespace containing dash

This commit is contained in:
Nicholas Rempel 2024-03-31 21:29:02 -07:00 committed by Dirkjan Ochtman
parent 7e3099c915
commit 78ed6a6730
1 changed files with 15 additions and 0 deletions

View File

@ -158,3 +158,18 @@ fn other_namespaces() {
Err::<StructOtherNamespace, _>(Error::UnknownPrefix("wrong".to_owned()))
);
}
#[derive(Debug, Eq, PartialEq, FromXml)]
#[xml(ns("URI", dashed-ns = "dashed"))]
struct DashedNs {
#[xml(ns("dashed"))]
element: String,
}
#[test]
fn dashed_ns() {
assert_eq!(
from_str("<DashedNs xmlns=\"URI\" xmlns:dashed-ns=\"dashed\"><dashed-ns:element>hello</dashed-ns:element></DashedNs>"),
Ok(DashedNs { element: "hello".to_owned() })
);
}