Skip to content

Commit 2f62ff3

Browse files
committed
tests: restore use of Command::cargo_bin() to support running under "cross"
1 parent 0665ee3 commit 2f62ff3

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package.version = "2.4.0-alpha.1"
1818
[workspace.dependencies]
1919
garden-tools = { path = ".", version = "2.4.0-alpha.1" }
2020
anyhow = "1.0"
21-
assert_cmd = "2.0"
21+
assert_cmd = "2.1"
2222
better_default = "1.0"
2323
clap = { version = "4.5", features = ["cargo", "derive", "string"] }
2424
clap-cargo = "0.17"

tests/common/mod.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use garden::model;
55
use garden::string;
66

77
use anyhow::Result;
8-
use assert_cmd::cargo;
8+
use assert_cmd::prelude::CommandCargoExt;
99

1010
use std::process::Command;
1111

@@ -147,8 +147,7 @@ pub fn exec_garden(args: &[&str]) -> Result<()> {
147147
argv.extend(args);
148148
display::print_command_vec(&argv);
149149

150-
let garden_path = cargo::cargo_bin!("garden");
151-
let mut exec = Command::new(garden_path);
150+
let mut exec = Command::cargo_bin("garden").expect("garden not found");
152151
exec.args(args);
153152

154153
assert!(exec.status().expect("garden returned an error").success());
@@ -162,8 +161,7 @@ pub fn garden_capture(args: &[&str]) -> String {
162161
argv.extend(args);
163162
display::print_command_vec(&argv);
164163

165-
let garden_path = cargo::cargo_bin!("garden");
166-
let mut exec = Command::new(garden_path);
164+
let mut exec = Command::cargo_bin("garden").expect("garden not found");
167165
exec.args(args);
168166
let capture = exec.output();
169167
assert!(capture.is_ok());
@@ -181,8 +179,7 @@ pub fn garden_exec(args: &[&str]) -> (i32, String, String) {
181179
argv.extend(args);
182180
display::print_command_vec(&argv);
183181

184-
let garden_path = cargo::cargo_bin!("garden");
185-
let mut exec = Command::new(garden_path);
182+
let mut exec = Command::cargo_bin("garden").expect("garden not found");
186183
exec.args(args);
187184
let output_result = exec.output();
188185
assert!(output_result.is_ok());

0 commit comments

Comments
 (0)