mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
xso-proc: improve combinatorial test coverage for attribute fields
This is to avoid another regression slip through the test suite, as had
happened in d4d520e
(fixed in this commit's parent).
This commit is contained in:
parent
c0d109d9be
commit
6ade419030
1 changed files with 23 additions and 11 deletions
|
@ -65,8 +65,16 @@ type Option = ((),);
|
||||||
type Result = ((),);
|
type Result = ((),);
|
||||||
|
|
||||||
static NS1: &str = "urn:example:ns1";
|
static NS1: &str = "urn:example:ns1";
|
||||||
|
static NS2: &str = "urn:example:ns2";
|
||||||
|
|
||||||
static SOME_NAME: &::xso::exports::rxml::strings::NcNameStr = {
|
static FOO_NAME: &::xso::exports::rxml::strings::NcNameStr = {
|
||||||
|
#[allow(unsafe_code)]
|
||||||
|
unsafe {
|
||||||
|
::xso::exports::rxml::strings::NcNameStr::from_str_unchecked("foo")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static BAR_NAME: &::xso::exports::rxml::strings::NcNameStr = {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe {
|
unsafe {
|
||||||
::xso::exports::rxml::strings::NcNameStr::from_str_unchecked("bar")
|
::xso::exports::rxml::strings::NcNameStr::from_str_unchecked("bar")
|
||||||
|
@ -157,7 +165,7 @@ fn empty_qname_check_has_precedence_over_attr_check() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(FromXml, IntoXml, PartialEq, Debug, Clone)]
|
#[derive(FromXml, IntoXml, PartialEq, Debug, Clone)]
|
||||||
#[xml(namespace = NS1, name = SOME_NAME)]
|
#[xml(namespace = NS1, name = BAR_NAME)]
|
||||||
struct NamePath;
|
struct NamePath;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -234,7 +242,7 @@ fn required_attribute_missing() {
|
||||||
struct RenamedAttribute {
|
struct RenamedAttribute {
|
||||||
#[xml(attribute = "a1")]
|
#[xml(attribute = "a1")]
|
||||||
foo: String,
|
foo: String,
|
||||||
#[xml(attribute = SOME_NAME)]
|
#[xml(attribute = BAR_NAME)]
|
||||||
bar: String,
|
bar: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,10 +259,14 @@ fn renamed_attribute_roundtrip() {
|
||||||
#[derive(FromXml, IntoXml, PartialEq, Debug, Clone)]
|
#[derive(FromXml, IntoXml, PartialEq, Debug, Clone)]
|
||||||
#[xml(namespace = NS1, name = "attr")]
|
#[xml(namespace = NS1, name = "attr")]
|
||||||
struct NamespacedAttribute {
|
struct NamespacedAttribute {
|
||||||
#[xml(attribute(namespace = "urn:example:ns1", name = "foo"))]
|
#[xml(attribute(namespace = "urn:example:ns1", name = FOO_NAME))]
|
||||||
foo: String,
|
foo_1: String,
|
||||||
#[xml(attribute(namespace = "urn:example:ns2", name = "foo"))]
|
#[xml(attribute(namespace = NS2, name = "foo"))]
|
||||||
bar: String,
|
foo_2: String,
|
||||||
|
#[xml(attribute(namespace = NS1, name = BAR_NAME))]
|
||||||
|
bar_1: String,
|
||||||
|
#[xml(attribute(namespace = "urn:example:ns2", name = "bar"))]
|
||||||
|
bar_2: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -266,8 +278,8 @@ fn namespaced_attribute_roundtrip_a() {
|
||||||
};
|
};
|
||||||
roundtrip_full::<NamespacedAttribute>(
|
roundtrip_full::<NamespacedAttribute>(
|
||||||
"<attr xmlns='urn:example:ns1'
|
"<attr xmlns='urn:example:ns1'
|
||||||
xmlns:tns0='urn:example:ns1' tns0:foo='a1'
|
xmlns:tns0='urn:example:ns1' tns0:foo='a1' tns0:bar='a3'
|
||||||
xmlns:tns1='urn:example:ns2' tns1:foo='a2'/>",
|
xmlns:tns1='urn:example:ns2' tns1:foo='a2' tns1:bar='a4'/>",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,8 +292,8 @@ fn namespaced_attribute_roundtrip_b() {
|
||||||
};
|
};
|
||||||
roundtrip_full::<NamespacedAttribute>(
|
roundtrip_full::<NamespacedAttribute>(
|
||||||
"<tns0:attr
|
"<tns0:attr
|
||||||
xmlns:tns0='urn:example:ns1' tns0:foo='bar'
|
xmlns:tns0='urn:example:ns1' tns0:foo='a1' tns0:bar='a3'
|
||||||
xmlns:tns1='urn:example:ns2' tns1:foo='a2'/>",
|
xmlns:tns1='urn:example:ns2' tns1:foo='a2' tns1:bar='a4'/>",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue