Extend test to cover . and _, too
This commit is contained in:
parent
6b483b7e6d
commit
2b691c5131
|
@ -134,7 +134,9 @@ impl NamespaceMeta {
|
||||||
(NsState::Prefix, TokenTree::Ident(id)) => NsState::Eq {
|
(NsState::Prefix, TokenTree::Ident(id)) => NsState::Eq {
|
||||||
prefix: id.to_string(),
|
prefix: id.to_string(),
|
||||||
},
|
},
|
||||||
(NsState::Eq { mut prefix }, TokenTree::Punct(punct)) if punct.as_char() == '-' => {
|
(NsState::Eq { mut prefix }, TokenTree::Punct(punct))
|
||||||
|
if punct.as_char() == '-' || punct.as_char() == '.' =>
|
||||||
|
{
|
||||||
prefix.push(punct.as_char());
|
prefix.push(punct.as_char());
|
||||||
NsState::Eq { prefix }
|
NsState::Eq { prefix }
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ fn other_namespaces() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq, FromXml)]
|
#[derive(Debug, Eq, PartialEq, FromXml)]
|
||||||
#[xml(ns("URI", dashed-ns = "dashed"))]
|
#[xml(ns("URI", da_sh.ed-ns = "dashed"))]
|
||||||
struct DashedNs {
|
struct DashedNs {
|
||||||
#[xml(ns("dashed"))]
|
#[xml(ns("dashed"))]
|
||||||
element: String,
|
element: String,
|
||||||
|
@ -169,7 +169,7 @@ struct DashedNs {
|
||||||
#[test]
|
#[test]
|
||||||
fn dashed_ns() {
|
fn dashed_ns() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
from_str("<DashedNs xmlns=\"URI\" xmlns:dashed-ns=\"dashed\"><dashed-ns:element>hello</dashed-ns:element></DashedNs>"),
|
from_str("<DashedNs xmlns=\"URI\" xmlns:da_sh.ed-ns=\"dashed\"><da_sh.ed-ns:element>hello</da_sh.ed-ns:element></DashedNs>"),
|
||||||
Ok(DashedNs { element: "hello".to_owned() })
|
Ok(DashedNs { element: "hello".to_owned() })
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue