Use cargo_bin!() macro instead of deprecated cargo_bin fn in integration tests - #1229
Open
MsfPablo wants to merge 1 commit into
Open
Use cargo_bin!() macro instead of deprecated cargo_bin fn in integration tests#1229MsfPablo wants to merge 1 commit into
MsfPablo wants to merge 1 commit into
Conversation
The integration-test helper used Command::cargo_bin(name).unwrap(), which relies on assert_cmd probing the target/ layout and has been deprecated in favor of the cargo_bin!() / cargo_bin_cmd!() macros. cargo_bin!() resolves the binary via the official CARGO_BIN_EXE_<name> env var set by Cargo, so it is robust to non-default build directories (CARGO_BUILD_BUILD_DIR) and no longer needs an unwrap(). Bumps the assert_cmd dev-dependency in the lockfile from 2.0.14 to 2.2.2 (the Cargo.toml constraint stays at "2"); the cargo_bin!() macro landed in 2.0.17. Closes lsd-rs#1178
Author
|
Ping on this. It's a mechanical swap to the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1178.
The integration-test helper
cmd()usedCommand::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(), which relies onassert_cmdprobing thetarget/layout. As tracked in #1178, that path is fragile under non-default build directories (e.g.CARGO_BUILD_BUILD_DIR) and thecargo_binfunction has been deprecated in favor of thecargo_bin!/cargo_bin_cmd!macros.This switches the helper to:
cargo_bin!()resolves the binary through the officialCARGO_BIN_EXE_lsdenv var that Cargo sets for the package's own bin target, so it is robust to the build directory and no longer needs an.unwrap().Dependency change
cargo_bin!()landed in assert_cmd 2.0.17, so this bumps theassert_cmddev-dependency in the lockfile from 2.0.14 → 2.2.2. TheCargo.tomlconstraint stays atassert_cmd = "2"(no tightening); this is a lockfile-only update.Verification
cargo build --tests— cleancargo test— 42 passed; the only failure (test_date_custom_format_supports_nanos_with_length) is pre-existing and locale-dependent (%.3femits a comma underLC_TIME=es_ES.UTF-8\)); it fails identically on cleanmainand passes under theen_US`/C locale used in CI.cargo fmt --check— cleancargo clippy --all-targets— no new warnings (the remaining ones are pre-existing insrc/display.rs)