From 7779eb74c8367bc718a2005b4af42796a5d0b023 Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Fri, 24 Sep 2021 14:45:09 -0700 Subject: [PATCH 1/2] make junit output more consistent with default format --- library/test/src/formatters/junit.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/test/src/formatters/junit.rs b/library/test/src/formatters/junit.rs index aa24480751419..44a33c92a9ff7 100644 --- a/library/test/src/formatters/junit.rs +++ b/library/test/src/formatters/junit.rs @@ -29,7 +29,8 @@ impl JunitFormatter { impl OutputFormatter for JunitFormatter { fn write_run_start(&mut self, _test_count: usize) -> io::Result<()> { // We write xml header on run start - self.write_message(&"") + self.out.write_all("\n".as_bytes())?; + self.write_message("") } fn write_test_start(&mut self, _desc: &TestDesc) -> io::Result<()> { @@ -133,6 +134,8 @@ impl OutputFormatter for JunitFormatter { self.write_message("")?; self.write_message("")?; + self.out.write_all("\n\n".as_bytes())?; + Ok(state.failed == 0) } } From 0911069febd6c247594c26e41c2e5cf8ffb8a74f Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Mon, 27 Sep 2021 14:50:35 -0700 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: kennytm --- library/test/src/formatters/junit.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/test/src/formatters/junit.rs b/library/test/src/formatters/junit.rs index 44a33c92a9ff7..04057906d1c3e 100644 --- a/library/test/src/formatters/junit.rs +++ b/library/test/src/formatters/junit.rs @@ -29,7 +29,7 @@ impl JunitFormatter { impl OutputFormatter for JunitFormatter { fn write_run_start(&mut self, _test_count: usize) -> io::Result<()> { // We write xml header on run start - self.out.write_all("\n".as_bytes())?; + self.out.write_all(b"\n")?; self.write_message("") } @@ -134,7 +134,7 @@ impl OutputFormatter for JunitFormatter { self.write_message("")?; self.write_message("")?; - self.out.write_all("\n\n".as_bytes())?; + self.out.write_all(b"\n\n")?; Ok(state.failed == 0) }