Skip to content

Commit 4eac5a1

Browse files
committed
Add test for environment variables in verbose mode for cargo bench
1 parent 9267277 commit 4eac5a1

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/testsuite/bench.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,3 +1688,40 @@ error: unexpected argument `--keep-going` found
16881688
.with_status(101)
16891689
.run();
16901690
}
1691+
1692+
#[cargo_test(nightly, reason = "bench")]
1693+
fn cargo_bench_print_env_verbose() {
1694+
let p = project()
1695+
.file("Cargo.toml", &basic_manifest("foo", "0.0.1"))
1696+
.file(
1697+
"src/main.rs",
1698+
r#"
1699+
#![feature(test)]
1700+
#[cfg(test)]
1701+
extern crate test;
1702+
1703+
fn hello() -> &'static str {
1704+
"hello"
1705+
}
1706+
1707+
pub fn main() {
1708+
println!("{}", hello())
1709+
}
1710+
1711+
#[bench]
1712+
fn bench_hello(_b: &mut test::Bencher) {
1713+
assert_eq!(hello(), "hello")
1714+
}
1715+
"#,
1716+
)
1717+
.build();
1718+
p.cargo("bench -vv")
1719+
.with_stderr(
1720+
"\
1721+
[COMPILING] foo v0.0.1 ([CWD])
1722+
[RUNNING] `[..]CARGO_MANIFEST_DIR=[CWD][..] rustc[..]`
1723+
[FINISHED] bench [optimized] target(s) in [..]
1724+
[RUNNING] `[..]CARGO_MANIFEST_DIR=[CWD][..] [CWD]/target/release/deps/foo-[..][EXE] --bench`",
1725+
)
1726+
.run();
1727+
}

0 commit comments

Comments
 (0)