diff options
| author | Augie Fackler <augie@google.com> | 2023-04-28 18:37:26 -0400 |
|---|---|---|
| committer | Augie Fackler <augie@google.com> | 2023-04-28 18:37:26 -0400 |
| commit | 58537cde0607eb3ca4076e00b8e2cfac52827ca1 (patch) | |
| tree | 0df496be0a46f4c4d26e60a6d7e3cb2ec40154c2 | |
| parent | 610f82726172c26d0a9f72fee3d72caad9bdb514 (diff) | |
| download | rust-58537cde0607eb3ca4076e00b8e2cfac52827ca1.tar.gz rust-58537cde0607eb3ca4076e00b8e2cfac52827ca1.zip | |
junit: fix typo in comment and don't include output for passes when not requested
| -rw-r--r-- | library/test/src/formatters/junit.rs | 4 | ||||
| -rw-r--r-- | tests/run-make/libtest-junit/output-default.xml | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/library/test/src/formatters/junit.rs b/library/test/src/formatters/junit.rs index 65883dd36a1..9f5bf24367e 100644 --- a/library/test/src/formatters/junit.rs +++ b/library/test/src/formatters/junit.rs @@ -31,7 +31,7 @@ fn str_to_cdata(s: &str) -> String { // `<?'` in a CDATA block, so the escaping gets a little weird. let escaped_output = s.replace("]]>", "]]]]><![CDATA[>"); let escaped_output = escaped_output.replace("<?", "<]]><![CDATA[?"); - // We also smuggle newlines as 
 so as to keep all the output on line line + // We also smuggle newlines as 
 so as to keep all the output on one line let escaped_output = escaped_output.replace("\n", "]]>
<![CDATA["); // Prune empty CDATA blocks resulting from any escaping let escaped_output = escaped_output.replace("<![CDATA[]]>", ""); @@ -163,7 +163,7 @@ impl<T: Write> OutputFormatter for JunitFormatter<T> { test_name, duration.as_secs_f64() ))?; - if stdout.is_empty() { + if stdout.is_empty() || !state.options.display_output { self.write_message("/>")?; } else { self.write_message("><system-out>")?; diff --git a/tests/run-make/libtest-junit/output-default.xml b/tests/run-make/libtest-junit/output-default.xml index 0c300611e1f..d59e07b8ad8 100644 --- a/tests/run-make/libtest-junit/output-default.xml +++ b/tests/run-make/libtest-junit/output-default.xml @@ -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]]>
<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="b" time="$TIME"><failure type="assert"/><system-out><![CDATA[print from failing test]]>
<![CDATA[thread 'b' panicked at 'assertion failed: false', f.rs:10:5]]>
<![CDATA[note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace]]>
<![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]]>
<![CDATA[]]></system-out></testcase><system-out/><system-err/></testsuite></testsuites> +<?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]]>
<![CDATA[thread 'b' panicked at 'assertion failed: false', f.rs:10:5]]>
<![CDATA[note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace]]>
<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="c" time="$TIME"/><system-out/><system-err/></testsuite></testsuites> |
