Skip to content

Commit 391f140

Browse files
authored
Fix deprecated code (#537)
1 parent 0d135aa commit 391f140

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

tests/integration_tests.rs

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
mod tests {
33

44
use anyhow::Result;
5+
use assert_cmd::cargo_bin;
56
use assert_cmd::prelude::*;
67
use assert_fs::prelude::*;
78
use function_runner::function_run_result::FunctionRunResult;
@@ -15,7 +16,7 @@ mod tests {
1516

1617
#[test]
1718
fn run() -> Result<()> {
18-
let mut cmd = Command::cargo_bin("function-runner")?;
19+
let mut cmd = Command::new(cargo_bin!());
1920
let input_file = temp_input(json!({"count": 0}))?;
2021

2122
cmd.args(["--function", "tests/fixtures/build/noop.wasm"])
@@ -28,7 +29,7 @@ mod tests {
2829

2930
#[test]
3031
fn invalid_json_input() -> Result<()> {
31-
let mut cmd = Command::cargo_bin("function-runner")?;
32+
let mut cmd = Command::new(cargo_bin!());
3233

3334
cmd.args(["--function", "tests/fixtures/build/exit_code.wasm"])
3435
.arg("--json")
@@ -42,7 +43,7 @@ mod tests {
4243

4344
#[test]
4445
fn run_stdin() -> Result<()> {
45-
let mut cmd = Command::cargo_bin("function-runner")?;
46+
let mut cmd = Command::new(cargo_bin!());
4647

4748
let input_file = temp_input(json!({"exit_code": 0}))?;
4849
let file = File::open(input_file.path())?;
@@ -65,7 +66,7 @@ mod tests {
6566

6667
#[test]
6768
fn run_no_opts() -> Result<()> {
68-
let mut cmd = Command::cargo_bin("function-runner")?;
69+
let mut cmd = Command::new(cargo_bin!());
6970
let output = cmd
7071
.stdout(Stdio::piped())
7172
.stderr(Stdio::piped())
@@ -88,7 +89,7 @@ mod tests {
8889
#[test]
8990
#[ignore = "This test hangs on CI but runs locally, is_terminal is likely returning false in CI"]
9091
fn run_function_no_input() -> Result<()> {
91-
let mut cmd = Command::cargo_bin("function-runner")?;
92+
let mut cmd = Command::new(cargo_bin!());
9293

9394
cmd.args(["--function", "tests/fixtures/build/exit_code.wasm"]);
9495
cmd.assert()
@@ -100,7 +101,7 @@ mod tests {
100101

101102
#[test]
102103
fn run_json() -> Result<()> {
103-
let mut cmd = Command::cargo_bin("function-runner")?;
104+
let mut cmd = Command::new(cargo_bin!());
104105
let input_file = temp_input(json!({"count": 0}))?;
105106

106107
cmd.args(["--function", "tests/fixtures/build/noop.wasm"])
@@ -117,7 +118,7 @@ mod tests {
117118

118119
#[test]
119120
fn wasm_file_doesnt_exist() -> Result<()> {
120-
let mut cmd = Command::cargo_bin("function-runner")?;
121+
let mut cmd = Command::new(cargo_bin!());
121122
let input_file = temp_input(json!({"exit_code": 0}))?;
122123

123124
cmd.args(["--function", "test/file/doesnt/exist"])
@@ -132,7 +133,7 @@ mod tests {
132133

133134
#[test]
134135
fn input_file_doesnt_exist() -> Result<()> {
135-
let mut cmd = Command::cargo_bin("function-runner")?;
136+
let mut cmd = Command::new(cargo_bin!());
136137

137138
cmd.args(["--function", "tests/fixtures/build/exit_code.wasm"])
138139
.args(["--input", "test/file/doesnt/exist.json"]);
@@ -174,7 +175,7 @@ mod tests {
174175

175176
#[test]
176177
fn incorrect_input() -> Result<()> {
177-
let mut cmd = Command::cargo_bin("function-runner")?;
178+
let mut cmd = Command::new(cargo_bin!());
178179
let input_file = temp_input(json!({}))?;
179180

180181
cmd.args(["--function", "tests/fixtures/build/exit_code.wasm"])
@@ -196,7 +197,7 @@ mod tests {
196197

197198
#[test]
198199
fn exports() -> Result<()> {
199-
let mut cmd = Command::cargo_bin("function-runner")?;
200+
let mut cmd = Command::new(cargo_bin!());
200201
let input_file = temp_input(json!({}))?;
201202
cmd.args(["--function", "tests/fixtures/build/exports.wasm"])
202203
.args(["--export", "export1"])
@@ -210,7 +211,7 @@ mod tests {
210211

211212
#[test]
212213
fn missing_export() -> Result<()> {
213-
let mut cmd = Command::cargo_bin("function-runner")?;
214+
let mut cmd = Command::new(cargo_bin!());
214215
let input_file = temp_input(json!({}))?;
215216
cmd.args(["--function", "tests/fixtures/build/exports.wasm"])
216217
.arg("--input")
@@ -225,7 +226,7 @@ mod tests {
225226

226227
#[test]
227228
fn failing_function_returns_non_zero_exit_code_for_module_errors() -> Result<()> {
228-
let mut cmd = Command::cargo_bin("function-runner")?;
229+
let mut cmd = Command::new(cargo_bin!());
229230
let input_file = temp_input(json!({}))?;
230231
cmd.args([
231232
"--function",
@@ -242,7 +243,7 @@ mod tests {
242243
}
243244

244245
fn profile_base_cmd_in_temp_dir() -> Result<(Command, assert_fs::TempDir)> {
245-
let mut cmd = Command::cargo_bin("function-runner")?;
246+
let mut cmd = Command::new(cargo_bin!());
246247
let cwd = std::env::current_dir()?;
247248
let temp = assert_fs::TempDir::new()?;
248249
let input_file = temp.child("input.json");
@@ -266,7 +267,7 @@ mod tests {
266267

267268
#[test]
268269
fn test_scale_limits_analyzer_use_defaults_when_query_and_schema_not_provided() -> Result<()> {
269-
let mut cmd = Command::cargo_bin("function-runner")?;
270+
let mut cmd = Command::new(cargo_bin!());
270271
let input_file = temp_input(json!({"cart": {
271272
"lines": [
272273
{"quantity": 2}
@@ -289,7 +290,7 @@ mod tests {
289290

290291
#[test]
291292
fn test_scale_limits_analyzer_use_defaults_when_query_or_schema_not_provided() -> Result<()> {
292-
let mut cmd = Command::cargo_bin("function-runner")?;
293+
let mut cmd = Command::new(cargo_bin!());
293294
let input_file = temp_input(json!({"cart": {
294295
"lines": [
295296
{"quantity": 2}
@@ -314,7 +315,7 @@ mod tests {
314315

315316
#[test]
316317
fn test_scale_limits_analyzer_with_scaled_limits() -> Result<()> {
317-
let mut cmd = Command::cargo_bin("function-runner")?;
318+
let mut cmd = Command::new(cargo_bin!());
318319

319320
let input_data = vec![json!({"quantity": 2}); 400];
320321
let json_data = json!({
@@ -349,7 +350,7 @@ mod tests {
349350

350351
#[test]
351352
fn run_javy_plugin_v2() -> Result<()> {
352-
let mut cmd = Command::cargo_bin("function-runner")?;
353+
let mut cmd = Command::new(cargo_bin!());
353354
let input = temp_input(json!({"hello": "world"}))?;
354355

355356
cmd.args([
@@ -386,7 +387,7 @@ mod tests {
386387
&trampolined_module,
387388
)?;
388389

389-
let mut cmd = Command::cargo_bin("function-runner")?;
390+
let mut cmd = Command::new(cargo_bin!());
390391
let input_file = temp_input(json!({"hello": "world"}))?;
391392

392393
cmd.arg("--function")
@@ -412,7 +413,7 @@ mod tests {
412413
&trampolined_module,
413414
)?;
414415

415-
let mut cmd = Command::cargo_bin("function-runner")?;
416+
let mut cmd = Command::new(cargo_bin!());
416417
let input_file = temp_input(json!({"hello": "world"}))?;
417418

418419
cmd.arg("--function")
@@ -437,7 +438,7 @@ mod tests {
437438

438439
#[test]
439440
fn run_javy_plugin_v3() -> Result<()> {
440-
let mut cmd = Command::cargo_bin("function-runner")?;
441+
let mut cmd = Command::new(cargo_bin!());
441442
let input = temp_input(json!({"hello": "world"}))?;
442443

443444
cmd.args([
@@ -466,7 +467,7 @@ mod tests {
466467

467468
#[test]
468469
fn invalid_import_combination() -> Result<()> {
469-
let mut cmd = Command::cargo_bin("function-runner")?;
470+
let mut cmd = Command::new(cargo_bin!());
470471
let input = temp_input(json!({"hello": "world"}))?;
471472

472473
cmd.args([

0 commit comments

Comments
 (0)