Skip to content

Commit 5cac956

Browse files
authored
Merge pull request #438 from epage/bin
feat(snapbox): Add Command::cargo_bin
2 parents 0a950a2 + e0f3374 commit 5cac956

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

crates/snapbox/src/cmd.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ pub struct Command {
1717

1818
/// # Builder API
1919
impl Command {
20+
/// Look up the path to a cargo-built binary within an integration test
21+
///
22+
/// Cargo support:
23+
/// - `>1.94`: works
24+
/// - `>=1.91,<=1.93`: works with default `build-dir`
25+
/// - `<=1.92`: works
26+
///
27+
/// # Panic
28+
///
29+
/// Panics if no binary is found
30+
pub fn cargo_bin(name: &str) -> Self {
31+
Self::new(cargo_bin(name))
32+
}
33+
2034
pub fn new(program: impl AsRef<std::ffi::OsStr>) -> Self {
2135
Self {
2236
cmd: std::process::Command::new(program),

0 commit comments

Comments
 (0)