on master help sign in
Run 'cargo run' only once
commitc6a526f99cc623a8f8a7419f23d1d02cd4334c2e authorsharkdp <davidpeter@web.de> dateFri 2 Nov 2018, 18:33 (8 years ago) parent278d841
3 files changed+15−1
Cargo.lock+1 Cargo.toml+1 tests/integration_tests.rs+13−1
Cargo.lock+1
@@ -66,6 +66,7 @@ dependencies = [
6666 "directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
6767 "encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
6868 "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
69+ "escargot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
6970 "git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
7071 "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
7172 "shell-words 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
Cargo.toml+1
@@ -49,6 +49,7 @@ features = []
4949[dev-dependencies]
5050tempdir = "0.3"
5151assert_cmd = "0.10.1"
52+escargot = "0.3.1"
5253
5354[build-dependencies]
5455clap = "2.32"
tests/integration_tests.rs+13−1
@@ -1,10 +1,22 @@
11extern crate assert_cmd;
2+extern crate escargot;
3+#[macro_use]
4+extern crate lazy_static;
25
36use assert_cmd::prelude::*;
7+use escargot::CargoRun;
48use std::process::Command;
59
10+lazy_static! {
11+ static ref CARGO_RUN: CargoRun = escargot::CargoBuild::new()
12+ .bin("bat")
13+ .current_release()
14+ .run()
15+ .unwrap();
16+}
17+
618fn bat_with_config() -> Command {
7− let mut cmd = Command::main_binary().unwrap();
19+ let mut cmd = CARGO_RUN.command();
820 cmd.current_dir("tests/examples");
921 cmd.env_remove("PAGER");
1022 cmd.env_remove("BAT_PAGER");