Skip to content

Commit 58537cd

Browse files
committed
junit: fix typo in comment and don't include output for passes when not requested
1 parent 610f827 commit 58537cd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

library/test/src/formatters/junit.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn str_to_cdata(s: &str) -> String {
3131
// `<?'` in a CDATA block, so the escaping gets a little weird.
3232
let escaped_output = s.replace("]]>", "]]]]><![CDATA[>");
3333
let escaped_output = escaped_output.replace("<?", "<]]><![CDATA[?");
34-
// We also smuggle newlines as &#xa so as to keep all the output on line line
34+
// We also smuggle newlines as &#xa so as to keep all the output on one line
3535
let escaped_output = escaped_output.replace("\n", "]]>&#xA;<![CDATA[");
3636
// Prune empty CDATA blocks resulting from any escaping
3737
let escaped_output = escaped_output.replace("<![CDATA[]]>", "");
@@ -163,7 +163,7 @@ impl<T: Write> OutputFormatter for JunitFormatter<T> {
163163
test_name,
164164
duration.as_secs_f64()
165165
))?;
166-
if stdout.is_empty() {
166+
if stdout.is_empty() || !state.options.display_output {
167167
self.write_message("/>")?;
168168
} else {
169169
self.write_message("><system-out>")?;
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?xml version="1.0" encoding="UTF-8"?><testsuites><testsuite name="test" package="test" id="0" errors="0" failures="1" tests="4" skipped="1" ><testcase classname="unknown" name="a" time="$TIME"><system-out><![CDATA[print from successful test]]>&#xA;<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="b" time="$TIME"><failure type="assert"/><system-out><![CDATA[print from failing test]]>&#xA;<![CDATA[thread 'b' panicked at 'assertion failed: false', f.rs:10:5]]>&#xA;<![CDATA[note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace]]>&#xA;<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="c" time="$TIME"><system-out><![CDATA[thread 'c' panicked at 'assertion failed: false', f.rs:16:5]]>&#xA;<![CDATA[]]></system-out></testcase><system-out/><system-err/></testsuite></testsuites>
1+
<?xml version="1.0" encoding="UTF-8"?><testsuites><testsuite name="test" package="test" id="0" errors="0" failures="1" tests="4" skipped="1" ><testcase classname="unknown" name="a" time="$TIME"/><testcase classname="unknown" name="b" time="$TIME"><failure type="assert"/><system-out><![CDATA[print from failing test]]>&#xA;<![CDATA[thread 'b' panicked at 'assertion failed: false', f.rs:10:5]]>&#xA;<![CDATA[note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace]]>&#xA;<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="c" time="$TIME"/><system-out/><system-err/></testsuite></testsuites>

0 commit comments

Comments
 (0)