Skip to content

Commit

Permalink
Add test for environment variables in verbose mode for cargo bench
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol committed Aug 16, 2023
1 parent 9267277 commit 4eac5a1
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/testsuite/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1688,3 +1688,40 @@ error: unexpected argument `--keep-going` found
.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();
}

0 comments on commit 4eac5a1

Please sign in to comment.