Skip to content

Commit b1ad2c8

Browse files
author
Mingshen Sun
committed
tests: use static command binary name to reduce startup time
According to this issue: assert-rs/assert_cmd#6. This also potentially solves lock issue in Travis.
1 parent 7c18432 commit b1ad2c8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

tests/macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ macro_rules! util_name {
1616
#[macro_export]
1717
macro_rules! new_cmd {
1818
() => {
19-
Command::main_binary().unwrap().arg(util_name!())
19+
Command::new(&*::BIN_PATH).arg(util_name!())
2020
};
2121
}
2222

tests/tests.rs

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ extern crate predicates;
1818
#[macro_use]
1919
mod macros;
2020

21+
use std::path::PathBuf;
22+
use assert_cmd::cargo;
23+
24+
lazy_static! {
25+
pub static ref BIN_PATH: PathBuf = cargo::main_binary_path().unwrap();
26+
}
2127
include!("../libmesabox/src/util/build/import.rs");
2228

2329
macro_rules! generate_fns {

0 commit comments

Comments
 (0)