1
0
mirror of https://github.com/sharkdp/bat.git synced 2026-02-08 00:32:08 +00:00

Merge pull request #3550 from nmacl/master

Use cargo_bin! macro to fix tests for future Cargo versions
This commit is contained in:
Keith Hall
2026-01-10 13:53:09 +02:00
committed by GitHub
5 changed files with 6 additions and 21 deletions

View File

@@ -9,6 +9,7 @@
## Bugfixes ## Bugfixes
- `--help` now correctly honors `--pager=builtin`. See #3516 (@keith-hall) - `--help` now correctly honors `--pager=builtin`. See #3516 (@keith-hall)
- `--help` now correctly honors custom themes. See #3524 (@keith-hall) - `--help` now correctly honors custom themes. See #3524 (@keith-hall)
- Fixed test compatibility with future Cargo build directory changes, see #3550 (@nmacl)
## Other ## Other

11
Cargo.lock generated
View File

@@ -83,13 +83,12 @@ checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f"
[[package]] [[package]]
name = "assert_cmd" name = "assert_cmd"
version = "2.0.16" version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc1835b7f27878de8525dc71410b5a31cdcc5f230aed5ba5df968e09c201b23d" checksum = "bcbb6924530aa9e0432442af08bbcafdad182db80d2e560da42a6d442535bf85"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"bstr", "bstr",
"doc-comment",
"libc", "libc",
"predicates", "predicates",
"predicates-core", "predicates-core",
@@ -471,12 +470,6 @@ version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59f8e79d1fbf76bdfbde321e902714bf6c49df88a7dda6fc682fc2979226962d" checksum = "59f8e79d1fbf76bdfbde321e902714bf6c49df88a7dda6fc682fc2979226962d"
[[package]]
name = "doc-comment"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]] [[package]]
name = "either" name = "either"
version = "1.13.0" version = "1.13.0"

View File

@@ -95,7 +95,7 @@ features = ["wrap_help", "cargo"]
plist = "1.7.0" plist = "1.7.0"
[dev-dependencies] [dev-dependencies]
assert_cmd = "2.0.12" assert_cmd = "2.0.16"
expect-test = "1.5.0" expect-test = "1.5.0"
serial_test = { version = "2.0.0", default-features = false } serial_test = { version = "2.0.0", default-features = false }
predicates = "3.1.3" predicates = "3.1.3"

View File

@@ -53,16 +53,7 @@ impl Default for BatTester {
fn default() -> Self { fn default() -> Self {
let temp_dir = create_sample_directory().expect("sample directory"); let temp_dir = create_sample_directory().expect("sample directory");
let root = env::current_exe() let exe = assert_cmd::cargo::cargo_bin!("bat").to_path_buf();
.expect("tests executable")
.parent()
.expect("tests executable directory")
.parent()
.expect("bat executable directory")
.to_path_buf();
let exe_name = if cfg!(windows) { "bat.exe" } else { "bat" };
let exe = root.join(exe_name);
BatTester { temp_dir, exe } BatTester { temp_dir, exe }
} }

View File

@@ -4,7 +4,7 @@ use assert_cmd::cargo::CommandCargoExt;
use std::process::Command; use std::process::Command;
pub fn bat_raw_command_with_config() -> Command { pub fn bat_raw_command_with_config() -> Command {
let mut cmd = Command::cargo_bin("bat").unwrap(); let mut cmd = Command::new(assert_cmd::cargo::cargo_bin!("bat"));
cmd.current_dir("tests/examples"); cmd.current_dir("tests/examples");
cmd.env_remove("BAT_CACHE_PATH"); cmd.env_remove("BAT_CACHE_PATH");
cmd.env_remove("BAT_CONFIG_DIR"); cmd.env_remove("BAT_CONFIG_DIR");