diff options
Diffstat (limited to 'src/tools/cargo/tests/testsuite/bench.rs')
-rw-r--r-- | src/tools/cargo/tests/testsuite/bench.rs | 61 |
1 files changed, 58 insertions, 3 deletions
diff --git a/src/tools/cargo/tests/testsuite/bench.rs b/src/tools/cargo/tests/testsuite/bench.rs index 581acbe15..d773308c6 100644 --- a/src/tools/cargo/tests/testsuite/bench.rs +++ b/src/tools/cargo/tests/testsuite/bench.rs @@ -314,9 +314,9 @@ fn cargo_bench_failing_test() { [RUNNING] [..] (target/release/deps/foo-[..][EXE])", ) .with_stdout_contains("[..]thread '[..]' panicked at[..]") - .with_stdout_contains("[..]assertion failed[..]") - .with_stdout_contains("[..]left: `\"hello\"`[..]") - .with_stdout_contains("[..]right: `\"nope\"`[..]") + .with_stdout_contains("[..]assertion [..]failed[..]") + .with_stdout_contains("[..]left: [..]\"hello\"[..]") + .with_stdout_contains("[..]right: [..]\"nope\"[..]") .with_stdout_contains("[..]src/main.rs:15[..]") .with_status(101) .run(); @@ -1670,3 +1670,58 @@ fn json_artifact_includes_executable_for_benchmark() { ) .run(); } + +#[cargo_test] +fn cargo_bench_no_keep_going() { + let p = project() + .file("Cargo.toml", &basic_bin_manifest("foo")) + .file("src/main.rs", "") + .build(); + + p.cargo("bench --keep-going") + .with_stderr( + "\ +error: unexpected argument `--keep-going` found + + tip: to run as many benchmarks as possible without failing fast, use `--no-fail-fast`", + ) + .with_status(101) + .run(); +} + +#[cargo_test(nightly, reason = "bench")] +fn cargo_bench_print_env_verbose() { + let p = project() + .file("Cargo.toml", &basic_manifest("foo", "0.0.1")) + .file( + "src/main.rs", + r#" + #![feature(test)] + #[cfg(test)] + extern crate test; + + fn hello() -> &'static str { + "hello" + } + + pub fn main() { + println!("{}", hello()) + } + + #[bench] + fn bench_hello(_b: &mut test::Bencher) { + assert_eq!(hello(), "hello") + } + "#, + ) + .build(); + p.cargo("bench -vv") + .with_stderr( + "\ +[COMPILING] foo v0.0.1 ([CWD]) +[RUNNING] `[..]CARGO_MANIFEST_DIR=[CWD][..] rustc[..]` +[FINISHED] bench [optimized] target(s) in [..] +[RUNNING] `[..]CARGO_MANIFEST_DIR=[CWD][..] [CWD]/target/release/deps/foo-[..][EXE] --bench`", + ) + .run(); +} |