From 36f06d4f3494524aff3f1e3c616bf7dbea61d169 Mon Sep 17 00:00:00 2001 From: Amolith Date: Mon, 2 Mar 2026 15:16:50 -0700 Subject: [PATCH] Replace deprecated Command::cargo_bin with cargo_bin_cmd! in tests --- 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(-) diff --git a/tests/cli_create.rs b/tests/cli_create.rs index 2ec6e615fc30332f69f7f5433e793ac7e9bc5b5a..9a464d11431439e4e8283b1306b2531368d2184d 100644 --- a/tests/cli_create.rs +++ b/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 } diff --git a/tests/cli_dep.rs b/tests/cli_dep.rs index e7668ac8eb8e0f7688275b78258b436bfd4bdee9..47f3bb4ab37d4d07c51ab5c159c64dc989661667 100644 --- a/tests/cli_dep.rs +++ b/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 } diff --git a/tests/cli_io.rs b/tests/cli_io.rs index 7b6c7c9c8d52b86e1311fa764d1f8b506ef6dbd0..ad1e843cdf8e459f4a27d59d2d5fe77697c77c37 100644 --- a/tests/cli_io.rs +++ b/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 } diff --git a/tests/cli_label.rs b/tests/cli_label.rs index 64f57ee24b0e4922e7cf27bd316482e4cb718099..811b35de9e6c45cd5a5d165cd5560d1ca8e5b709 100644 --- a/tests/cli_label.rs +++ b/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 } diff --git a/tests/cli_list_show.rs b/tests/cli_list_show.rs index b672fb18e73cbb325ccbbf181d94061f67dbe18f..32dcb12b89142ba1f69ca02e132a1224291e9c38 100644 --- a/tests/cli_list_show.rs +++ b/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 } diff --git a/tests/cli_log.rs b/tests/cli_log.rs index b8080db997096f8dfb4ac4cb8823a7dbedd5d9ef..5080383f78057fdfcba744776ca62c1beed2c0c1 100644 --- a/tests/cli_log.rs +++ b/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 } diff --git a/tests/cli_migrate.rs b/tests/cli_migrate.rs index 2e0fbc4fa65d92e1aa83067c12b2295750cd28b4..a757e20ff8730274353a5f5b1138fc82c570be6b 100644 --- a/tests/cli_migrate.rs +++ b/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 } diff --git a/tests/cli_next.rs b/tests/cli_next.rs index bcb8256e1e0c8a81b3e128d056d9bff7a495b406..7e0454781e5be55b4d6335eaa5bfdb4adb9de273 100644 --- a/tests/cli_next.rs +++ b/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 } diff --git a/tests/cli_project.rs b/tests/cli_project.rs index 7ee7b3fd8471fe4e4f3bd4633207912b540e293a..72a9e2ac4beb86d1ca2bbac0c625a3be53dbe0e1 100644 --- a/tests/cli_project.rs +++ b/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 } diff --git a/tests/cli_query.rs b/tests/cli_query.rs index e65bff6d1825b1aeca4d3ea0471440fdc4d05a90..e8334466188d36f14157f4324cd86a64bb932a0b 100644 --- a/tests/cli_query.rs +++ b/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 } diff --git a/tests/cli_rm.rs b/tests/cli_rm.rs index 6e37c21c42cf87c03b7c6e67d6526db12186c99c..b4b99aab195f67b33e338e41fc60b3bfb334b44b 100644 --- a/tests/cli_rm.rs +++ b/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 } diff --git a/tests/cli_sync.rs b/tests/cli_sync.rs index e558cf7a7e388cdf59182b2a34484ef25e9d638c..26df6bd466442b7d2b0c40729f32c44d2d21c7a5 100644 --- a/tests/cli_sync.rs +++ b/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()); diff --git a/tests/cli_tidy.rs b/tests/cli_tidy.rs index 0a70e4d99142b845aa5fbbeda38d75556066a542..2e59278b15ddfdfaae2ef7a4d4687a23e51f88ca 100644 --- a/tests/cli_tidy.rs +++ b/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 } diff --git a/tests/cli_update.rs b/tests/cli_update.rs index 267151482f91c97737519157bef370a46ec9caea..b30b2f39aa84dcb6e5ed9a849d3a165581bf0c57 100644 --- a/tests/cli_update.rs +++ b/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 } diff --git a/tests/repro_compact.rs b/tests/repro_compact.rs index cb01243a96448cd7aadbdc44b5f9cbbcc75544b4..38f35b13295f9a02812e752c1c08a24df33d750c 100644 --- a/tests/repro_compact.rs +++ b/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 }