mookid/diffr

Allow specifying binary path in tests

Closed this issue · 0 comments

Currently, the path that the tests use to find the diffr binary expects that the tests are being run from cargo:

diffr/src/test_cli.rs

Lines 59 to 65 in 2c87325

fn diffr_path() -> PathBuf {
let mut dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
dir.push("target");
dir.push("debug");
dir.push("diffr");
dir
}

This can cause issues when packaging diffr for distributions (see NixOS/nixpkgs#69505, where doCheck = false disables running the package's tests).

It would be great if there was a way to provide the path, with $CARGO_MANIFEST_DIR/target/debug/diffr being a fallback, perhaps through a DIFFR_TESTS_BINARY_PATH environment variable or something like that.