parsers: add xso test module

Separate from the macro_tests module because it doesn't actually test
macros, it uses it as a convenience.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2024-11-21 20:41:56 +01:00
commit 947d84c0d2

View file

@ -46,7 +46,7 @@ mod helpers {
use self::helpers::{parse_str, roundtrip_full};
use xso::{AsXml, FromXml};
use xso::{AsXml, FromXml, PrintRawXml};
// these are adverserial local names in order to trigger any issues with
// unqualified names in the macro expansions.
@ -2191,3 +2191,12 @@ fn flag_absent_roundtrip() {
};
roundtrip_full::<Flag>("<foo xmlns='urn:example:ns1'/>");
}
#[test]
fn printrawxml() {
let text = TextString {
text: String::from("hello world"),
};
let display = format!("{}", PrintRawXml(&text));
assert_eq!(display, "<text xmlns='urn:example:ns1'>hello world</text>");
}