Skip to content

Commit 5291863

Browse files
committed
fix: Switch from --nocapture to --no-capture
`--no-capture` was added in 1.88, with `--nocapture` being soft-deprecated.
1 parent 43bb5c9 commit 5291863

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

src/cargo/ops/cargo_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,11 +427,11 @@ fn report_test_error(
427427
crate::display_error(&err, &mut ws.gctx().shell());
428428

429429
let harness: bool = unit_err.unit.target.harness();
430-
let nocapture: bool = test_args.contains(&"--nocapture");
430+
let nocapture: bool = test_args.contains(&"--nocapture") || test_args.contains(&"--no-capture");
431431

432432
if !is_simple && executed && harness && !nocapture {
433433
drop(ws.gctx().shell().note(
434-
"test exited abnormally; to see the full output pass --nocapture to the harness.",
434+
"test exited abnormally; to see the full output pass --no-capture to the harness.",
435435
));
436436
}
437437
}

src/doc/man/cargo-bench.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ for more information on per-target settings.
126126

127127
By default the Rust test harness hides output from benchmark execution to keep
128128
results readable. Benchmark output can be recovered (e.g., for debugging) by
129-
passing `--nocapture` to the benchmark binaries:
129+
passing `--no-capture` to the benchmark binaries:
130130

131-
cargo bench -- --nocapture
131+
cargo bench -- --no-capture
132132

133133
{{#options}}
134134

src/doc/man/cargo-test.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ target options.
150150

151151
By default the Rust test harness hides output from test execution to keep
152152
results readable. Test output can be recovered (e.g., for debugging) by passing
153-
`--nocapture` to the test binaries:
153+
`--no-capture` to the test binaries:
154154

155-
cargo test -- --nocapture
155+
cargo test -- --no-capture
156156

157157
{{#options}}
158158

src/etc/cargo.bashcomp.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ _cargo()
9191
local opt__vendor="$opt_common $opt_mani $opt_lock $opt_sync --no-delete --respect-source-config --versioned-dirs"
9292
local opt__version="$opt_common $opt_lock"
9393
local opt__yank="$opt_common $opt_lock --version --undo --index --token --registry"
94-
local opt__libtest="--help --include-ignored --ignored --test --bench --list --logfile --nocapture --test-threads --skip -q --quiet --exact --color --format"
94+
local opt__libtest="--help --include-ignored --ignored --test --bench --list --logfile --no-capture --test-threads --skip -q --quiet --exact --color --format"
9595

9696
if [[ $cword -gt $dd_i ]]; then
9797
# Completion after -- separator.

tests/testsuite/old_cargos.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! tested 1.0 to 1.51. Run this with:
88
//!
99
//! ```console
10-
//! cargo test --test testsuite -- old_cargos --nocapture --ignored
10+
//! cargo test --test testsuite -- old_cargos --no-capture --ignored
1111
//! ```
1212
1313
use std::fs;

tests/testsuite/package.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3075,7 +3075,7 @@ fn long_file_names() {
30753075
let test_path = test_path.join(long_name);
30763076
if let Err(e) = File::create(&test_path) {
30773077
// write to stderr directly to avoid output from being captured
3078-
// and always display text, even without --nocapture
3078+
// and always display text, even without --no-capture
30793079
use std::io::Write;
30803080
writeln!(
30813081
std::io::stderr(),

tests/testsuite/test.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,7 +2001,7 @@ fn test_no_harness() {
20012001
.file("foo.rs", "fn main() {}")
20022002
.build();
20032003

2004-
p.cargo("test -- --nocapture")
2004+
p.cargo("test -- --no-capture")
20052005
.with_stderr_data(str![[r#"
20062006
[COMPILING] foo v0.0.1 ([ROOT]/foo)
20072007
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
@@ -3901,7 +3901,7 @@ fn cargo_test_env() {
39013901
.unwrap()
39023902
.replace(rustc_host, "[HOST_TARGET]")
39033903
);
3904-
p.cargo("test --lib -- --nocapture")
3904+
p.cargo("test --lib -- --no-capture")
39053905
.with_stderr_contains(cargo)
39063906
.with_stdout_data(str![[r#"
39073907
...
@@ -3923,7 +3923,7 @@ test env_test ... ok
39233923
.replace(p.root().parent().unwrap().to_str().unwrap(), "[ROOT]")
39243924
);
39253925
p.process(other_cargo_path)
3926-
.args(&["test", "--lib", "--", "--nocapture"])
3926+
.args(&["test", "--lib", "--", "--no-capture"])
39273927
.with_stderr_contains(stderr_other_cargo)
39283928
.with_stdout_data(str![[r#"
39293929
...
@@ -5398,20 +5398,20 @@ this is a normal error
53985398
53995399
Caused by:
54005400
process didn't exit successfully: `[ROOT]/foo/target/debug/deps/t2-[HASH][EXE]` ([EXIT_STATUS]: 4)
5401-
[NOTE] test exited abnormally; to see the full output pass --nocapture to the harness.
5401+
[NOTE] test exited abnormally; to see the full output pass --no-capture to the harness.
54025402
54035403
"#]])
54045404
.with_status(4)
54055405
.run();
54065406

5407-
p.cargo("test --test t2 -- --nocapture")
5407+
p.cargo("test --test t2 -- --no-capture")
54085408
.with_stderr_data(str![[r#"
54095409
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
54105410
[RUNNING] tests/t2.rs (target/debug/deps/t2-[HASH][EXE])
54115411
[ERROR] test failed, to rerun pass `--test t2`
54125412
54135413
Caused by:
5414-
process didn't exit successfully: `[ROOT]/foo/target/debug/deps/t2-[HASH][EXE] --nocapture` ([EXIT_STATUS]: 4)
5414+
process didn't exit successfully: `[ROOT]/foo/target/debug/deps/t2-[HASH][EXE] --no-capture` ([EXIT_STATUS]: 4)
54155415
54165416
"#]])
54175417
.with_status(4)
@@ -5428,7 +5428,7 @@ Caused by:
54285428
54295429
Caused by:
54305430
process didn't exit successfully: `[ROOT]/foo/target/debug/deps/t2-[HASH][EXE]` ([EXIT_STATUS]: 4)
5431-
[NOTE] test exited abnormally; to see the full output pass --nocapture to the harness.
5431+
[NOTE] test exited abnormally; to see the full output pass --no-capture to the harness.
54325432
[ERROR] 2 targets failed:
54335433
`--test t1`
54345434
`--test t2`
@@ -5437,15 +5437,15 @@ Caused by:
54375437
.with_status(101)
54385438
.run();
54395439

5440-
p.cargo("test --no-fail-fast -- --nocapture")
5440+
p.cargo("test --no-fail-fast -- --no-capture")
54415441
.with_stderr_does_not_contain(
5442-
"test exited abnormally; to see the full output pass --nocapture to the harness.",
5442+
"test exited abnormally; to see the full output pass --no-capture to the harness.",
54435443
)
54445444
.with_stderr_data(str![[r#"
54455445
[..]thread [..]panicked [..] tests/t1.rs[..]
54465446
[NOTE] run with `RUST_BACKTRACE=1` environment variable to display a backtrace
54475447
Caused by:
5448-
process didn't exit successfully: `[ROOT]/foo/target/debug/deps/t2-[HASH][EXE] --nocapture` ([EXIT_STATUS]: 4)
5448+
process didn't exit successfully: `[ROOT]/foo/target/debug/deps/t2-[HASH][EXE] --no-capture` ([EXIT_STATUS]: 4)
54495449
...
54505450
"#]].unordered())
54515451
.with_status(101)
@@ -5513,6 +5513,6 @@ fn cargo_test_set_out_dir_env_var() {
55135513
.build();
55145514

55155515
p.cargo("test").run();
5516-
p.cargo("test --package foo --test case -- tests::test_add --exact --nocapture")
5516+
p.cargo("test --package foo --test case -- tests::test_add --exact --no-capture")
55175517
.run();
55185518
}

0 commit comments

Comments
 (0)