File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,22 @@ mod __doctest_mod {{
131
131
.output()
132
132
.expect(\"failed to run command\");
133
133
if !out.status.success() {{
134
- eprint!(\"{{}}\", String::from_utf8_lossy(&out.stderr));
134
+ if let Some(code) = out.status.code() {{
135
+ eprintln!(\"Test executable failed (exit status: {{code}}).\");
136
+ }} else {{
137
+ eprintln!(\"Test executable failed (terminated by signal).\");
138
+ }}
139
+ if !out.stdout.is_empty() || !out.stderr.is_empty() {{
140
+ eprintln!();
141
+ }}
142
+ if !out.stdout.is_empty() {{
143
+ eprintln!(\"stdout:\");
144
+ eprintln!(\"{{}}\", String::from_utf8_lossy(&out.stdout));
145
+ }}
146
+ if !out.stderr.is_empty() {{
147
+ eprintln!(\"stderr:\");
148
+ eprintln!(\"{{}}\", String::from_utf8_lossy(&out.stderr));
149
+ }}
135
150
ExitCode::FAILURE
136
151
}} else {{
137
152
ExitCode::SUCCESS
Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ test $DIR/edition-2024-error-output.rs - (line 12) ... FAILED
5
5
failures:
6
6
7
7
---- $DIR/edition-2024-error-output.rs - (line 12) stdout ----
8
+ Test executable failed (exit status: 101).
9
+
10
+ stderr:
8
11
9
12
thread 'main' panicked at $TMP:6:1:
10
13
assertion `left == right` failed
@@ -13,6 +16,7 @@ assertion `left == right` failed
13
16
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
14
17
15
18
19
+
16
20
failures:
17
21
$DIR/edition-2024-error-output.rs - (line 12)
18
22
You can’t perform that action at this time.
0 commit comments