make junit output more consistent with default format

This commit is contained in:
Jane Lusby 2021-09-24 14:45:09 -07:00
parent 73422130ee
commit 7779eb74c8

View File

@ -29,7 +29,8 @@ fn write_message(&mut self, s: &str) -> io::Result<()> {
impl<T: Write> OutputFormatter for JunitFormatter<T> {
fn write_run_start(&mut self, _test_count: usize) -> io::Result<()> {
// We write xml header on run start
self.write_message(&"<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
self.out.write_all("\n".as_bytes())?;
self.write_message("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
}
fn write_test_start(&mut self, _desc: &TestDesc) -> io::Result<()> {
@ -133,6 +134,8 @@ fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result<bool> {
self.write_message("</testsuite>")?;
self.write_message("</testsuites>")?;
self.out.write_all("\n\n".as_bytes())?;
Ok(state.failed == 0)
}
}