//! Test CDATA parsing in various elements
use junit_parser;
use std::io::Cursor;
#[test]
fn test_cdata_failure() {
let xml = r#"
]]>
"#;
let cursor = Cursor::new(xml);
let r = junit_parser::from_reader(cursor);
assert!(r.is_ok());
let suite = &r.unwrap().suites[0];
assert_eq!(suite.cases.len(), 1);
let tc = &suite.cases[0];
assert_eq!(tc.name, "AFailingTest");
let tf = tc.status.failure_as_ref();
assert_eq!(
tf.text,
r#"
"#
);
}
#[test]
fn test_cdata_error() {
let xml = r#"
]]>
"#;
let cursor = Cursor::new(xml);
let r = junit_parser::from_reader(cursor);
assert!(r.is_ok());
let suite = &r.unwrap().suites[0];
assert_eq!(suite.cases.len(), 1);
let tc = &suite.cases[0];
assert_eq!(tc.name, "AFailingTest");
let te = tc.status.error_as_ref();
assert_eq!(
te.text,
r#"
"#
);
}
#[test]
fn test_cdata_skipped() {
let xml = r#"
]]>
"#;
let cursor = Cursor::new(xml);
let r = junit_parser::from_reader(cursor);
assert!(r.is_ok());
let suite = &r.unwrap().suites[0];
assert_eq!(suite.cases.len(), 1);
let tc = &suite.cases[0];
assert_eq!(tc.name, "ASkippedTest");
let ts = tc.status.skipped_as_ref();
assert_eq!(
ts.text,
r#"
"#
);
}