Replace deprecated Command::cargo_bin with cargo_bin_cmd! in tests

Amolith created

Change summary

tests/cli_create.rs    | 6 +++---
tests/cli_dep.rs       | 6 +++---
tests/cli_io.rs        | 6 +++---
tests/cli_label.rs     | 6 +++---
tests/cli_list_show.rs | 6 +++---
tests/cli_log.rs       | 6 +++---
tests/cli_migrate.rs   | 6 +++---
tests/cli_next.rs      | 6 +++---
tests/cli_project.rs   | 6 +++---
tests/cli_query.rs     | 6 +++---
tests/cli_rm.rs        | 6 +++---
tests/cli_sync.rs      | 9 ++++-----
tests/cli_tidy.rs      | 6 +++---
tests/cli_update.rs    | 6 +++---
tests/repro_compact.rs | 6 +++---
15 files changed, 46 insertions(+), 47 deletions(-)

Detailed changes

tests/cli_create.rs 🔗

@@ -1,9 +1,9 @@
-use assert_cmd::Command;
+use assert_cmd::cargo::cargo_bin_cmd;
 use predicates::prelude::*;
 use tempfile::TempDir;
 
-fn td(home: &TempDir) -> Command {
-    let mut cmd = Command::cargo_bin("td").unwrap();
+fn td(home: &TempDir) -> assert_cmd::Command {
+    let mut cmd = cargo_bin_cmd!("td");
     cmd.env("HOME", home.path());
     cmd
 }

tests/cli_dep.rs 🔗

@@ -1,9 +1,9 @@
-use assert_cmd::Command;
+use assert_cmd::cargo::cargo_bin_cmd;
 use predicates::prelude::*;
 use tempfile::TempDir;
 
-fn td(home: &TempDir) -> Command {
-    let mut cmd = Command::cargo_bin("td").unwrap();
+fn td(home: &TempDir) -> assert_cmd::Command {
+    let mut cmd = cargo_bin_cmd!("td");
     cmd.env("HOME", home.path());
     cmd
 }

tests/cli_io.rs 🔗

@@ -1,8 +1,8 @@
-use assert_cmd::Command;
+use assert_cmd::cargo::cargo_bin_cmd;
 use tempfile::TempDir;
 
-fn td(home: &TempDir) -> Command {
-    let mut cmd = Command::cargo_bin("td").unwrap();
+fn td(home: &TempDir) -> assert_cmd::Command {
+    let mut cmd = cargo_bin_cmd!("td");
     cmd.env("HOME", home.path());
     cmd
 }

tests/cli_label.rs 🔗

@@ -1,9 +1,9 @@
-use assert_cmd::Command;
+use assert_cmd::cargo::cargo_bin_cmd;
 use predicates::prelude::*;
 use tempfile::TempDir;
 
-fn td(home: &TempDir) -> Command {
-    let mut cmd = Command::cargo_bin("td").unwrap();
+fn td(home: &TempDir) -> assert_cmd::Command {
+    let mut cmd = cargo_bin_cmd!("td");
     cmd.env("HOME", home.path());
     cmd
 }

tests/cli_list_show.rs 🔗

@@ -1,9 +1,9 @@
-use assert_cmd::Command;
+use assert_cmd::cargo::cargo_bin_cmd;
 use predicates::prelude::*;
 use tempfile::TempDir;
 
-fn td(home: &TempDir) -> Command {
-    let mut cmd = Command::cargo_bin("td").unwrap();
+fn td(home: &TempDir) -> assert_cmd::Command {
+    let mut cmd = cargo_bin_cmd!("td");
     cmd.env("HOME", home.path());
     cmd
 }

tests/cli_log.rs 🔗

@@ -1,9 +1,9 @@
-use assert_cmd::Command;
+use assert_cmd::cargo::cargo_bin_cmd;
 use predicates::prelude::*;
 use tempfile::TempDir;
 
-fn td(home: &TempDir) -> Command {
-    let mut cmd = Command::cargo_bin("td").unwrap();
+fn td(home: &TempDir) -> assert_cmd::Command {
+    let mut cmd = cargo_bin_cmd!("td");
     cmd.env("HOME", home.path());
     cmd
 }

tests/cli_migrate.rs 🔗

@@ -1,9 +1,9 @@
-use assert_cmd::Command;
+use assert_cmd::cargo::cargo_bin_cmd;
 use predicates::prelude::*;
 use tempfile::TempDir;
 
-fn td(home: &TempDir) -> Command {
-    let mut cmd = Command::cargo_bin("td").unwrap();
+fn td(home: &TempDir) -> assert_cmd::Command {
+    let mut cmd = cargo_bin_cmd!("td");
     cmd.env("HOME", home.path());
     cmd
 }

tests/cli_next.rs 🔗

@@ -1,9 +1,9 @@
-use assert_cmd::Command;
+use assert_cmd::cargo::cargo_bin_cmd;
 use predicates::prelude::*;
 use tempfile::TempDir;
 
-fn td(home: &TempDir) -> Command {
-    let mut cmd = Command::cargo_bin("td").unwrap();
+fn td(home: &TempDir) -> assert_cmd::Command {
+    let mut cmd = cargo_bin_cmd!("td");
     cmd.env("HOME", home.path());
     cmd
 }

tests/cli_project.rs 🔗

@@ -1,9 +1,9 @@
-use assert_cmd::Command;
+use assert_cmd::cargo::cargo_bin_cmd;
 use predicates::prelude::*;
 use tempfile::TempDir;
 
-fn td(home: &TempDir) -> Command {
-    let mut cmd = Command::cargo_bin("td").unwrap();
+fn td(home: &TempDir) -> assert_cmd::Command {
+    let mut cmd = cargo_bin_cmd!("td");
     cmd.env("HOME", home.path());
     cmd
 }

tests/cli_query.rs 🔗

@@ -1,9 +1,9 @@
-use assert_cmd::Command;
+use assert_cmd::cargo::cargo_bin_cmd;
 use predicates::prelude::*;
 use tempfile::TempDir;
 
-fn td(home: &TempDir) -> Command {
-    let mut cmd = Command::cargo_bin("td").unwrap();
+fn td(home: &TempDir) -> assert_cmd::Command {
+    let mut cmd = cargo_bin_cmd!("td");
     cmd.env("HOME", home.path());
     cmd
 }

tests/cli_rm.rs 🔗

@@ -1,9 +1,9 @@
-use assert_cmd::Command;
+use assert_cmd::cargo::cargo_bin_cmd;
 use predicates::prelude::*;
 use tempfile::TempDir;
 
-fn td(home: &TempDir) -> Command {
-    let mut cmd = Command::cargo_bin("td").unwrap();
+fn td(home: &TempDir) -> assert_cmd::Command {
+    let mut cmd = cargo_bin_cmd!("td");
     cmd.env("HOME", home.path());
     cmd
 }

tests/cli_sync.rs 🔗

@@ -1,10 +1,10 @@
-use assert_cmd::Command;
+use assert_cmd::cargo::cargo_bin_cmd;
 use loro::{ExportMode, LoroDoc, VersionVector};
 use predicates::prelude::*;
 
 #[test]
 fn sync_help_shows_usage() {
-    let mut cmd = Command::cargo_bin("td").unwrap();
+    let mut cmd = cargo_bin_cmd!("td");
     cmd.args(["sync", "--help"]);
     cmd.assert()
         .success()
@@ -16,15 +16,14 @@ fn sync_invalid_code_format_fails() {
     let home = tempfile::tempdir().unwrap();
     let cwd = tempfile::tempdir().unwrap();
 
-    Command::cargo_bin("td")
-        .unwrap()
+    cargo_bin_cmd!("td")
         .args(["project", "init", "synctest"])
         .current_dir(cwd.path())
         .env("HOME", home.path())
         .assert()
         .success();
 
-    let mut cmd = Command::cargo_bin("td").unwrap();
+    let mut cmd = cargo_bin_cmd!("td");
     cmd.args(["sync", "not-a-valid-code"])
         .current_dir(cwd.path())
         .env("HOME", home.path());

tests/cli_tidy.rs 🔗

@@ -1,9 +1,9 @@
-use assert_cmd::Command;
+use assert_cmd::cargo::cargo_bin_cmd;
 use predicates::prelude::*;
 use tempfile::TempDir;
 
-fn td(home: &TempDir) -> Command {
-    let mut cmd = Command::cargo_bin("td").unwrap();
+fn td(home: &TempDir) -> assert_cmd::Command {
+    let mut cmd = cargo_bin_cmd!("td");
     cmd.env("HOME", home.path());
     cmd
 }

tests/cli_update.rs 🔗

@@ -1,9 +1,9 @@
-use assert_cmd::Command;
+use assert_cmd::cargo::cargo_bin_cmd;
 use predicates::prelude::*;
 use tempfile::TempDir;
 
-fn td(home: &TempDir) -> Command {
-    let mut cmd = Command::cargo_bin("td").unwrap();
+fn td(home: &TempDir) -> assert_cmd::Command {
+    let mut cmd = cargo_bin_cmd!("td");
     cmd.env("HOME", home.path());
     cmd
 }

tests/repro_compact.rs 🔗

@@ -1,8 +1,8 @@
-use assert_cmd::Command;
+use assert_cmd::cargo::cargo_bin_cmd;
 use tempfile::TempDir;
 
-fn td(home: &TempDir) -> Command {
-    let mut cmd = Command::cargo_bin("td").unwrap();
+fn td(home: &TempDir) -> assert_cmd::Command {
+    let mut cmd = cargo_bin_cmd!("td");
     cmd.env("HOME", home.path());
     cmd
 }