Skip to content

Commit e5502cd

Browse files
committed
cargo: upgrade assert_cmd to 2.1.1
Dependabot couldn't do this because some methods became deprecated.
1 parent 60718d6 commit e5502cd

File tree

6 files changed

+26
-32
lines changed

6 files changed

+26
-32
lines changed

Cargo.lock

Lines changed: 2 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ categories = ["version-control", "development-tools"]
1717
keywords = ["VCS", "DVCS", "SCM", "Git", "Mercurial"]
1818

1919
[workspace.dependencies]
20-
assert_cmd = "2.0.8"
20+
assert_cmd = "2.1.1"
2121
assert_matches = "1.5.0"
2222
async-trait = "0.1.89"
2323
blake2 = "0.10.6"

cli/tests/common/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ pub use self::test_environment::TestEnvironment;
2222
pub use self::test_environment::TestWorkDir;
2323

2424
pub fn fake_bisector_path() -> String {
25-
let path = assert_cmd::cargo::cargo_bin("fake-bisector");
25+
let path = assert_cmd::cargo::cargo_bin!("fake-bisector");
2626
assert!(path.is_file());
27-
path.into_os_string().into_string().unwrap()
27+
path.as_os_str().to_str().unwrap().to_owned()
2828
}
2929

3030
pub fn fake_editor_path() -> String {
31-
let path = assert_cmd::cargo::cargo_bin("fake-editor");
31+
let path = assert_cmd::cargo::cargo_bin!("fake-editor");
3232
assert!(path.is_file());
33-
path.into_os_string().into_string().unwrap()
33+
path.as_os_str().to_str().unwrap().to_owned()
3434
}
3535

3636
pub fn fake_diff_editor_path() -> String {
37-
let path = assert_cmd::cargo::cargo_bin("fake-diff-editor");
37+
let path = assert_cmd::cargo::cargo_bin!("fake-diff-editor");
3838
assert!(path.is_file());
39-
path.into_os_string().into_string().unwrap()
39+
path.as_os_str().to_str().unwrap().to_owned()
4040
}
4141

4242
/// Forcibly enable interactive prompt.

cli/tests/common/test_environment.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ impl TestEnvironment {
113113
/// Use `run_jj_with()` to run command within customized environment.
114114
#[must_use]
115115
pub fn new_jj_cmd(&self) -> assert_cmd::Command {
116-
let mut cmd = assert_cmd::Command::cargo_bin("jj").unwrap();
116+
let jj_path = assert_cmd::cargo::cargo_bin!("jj");
117+
let mut cmd = assert_cmd::Command::new(jj_path);
117118
cmd.current_dir(&self.env_root);
118119
cmd.env_clear();
119120
cmd.env("COLUMNS", "100");

cli/tests/test_fix_command.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::common::TestEnvironment;
2424
use crate::common::to_toml_value;
2525

2626
fn set_up_fake_formatter(test_env: &TestEnvironment, args: &[&str]) {
27-
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
27+
let formatter_path = assert_cmd::cargo::cargo_bin!("fake-formatter");
2828
assert!(formatter_path.is_file());
2929
test_env.add_config(formatdoc! {"
3030
[fix.tools.fake-formatter]
@@ -68,7 +68,7 @@ fn test_config_multiple_tools() {
6868
let test_env = TestEnvironment::default();
6969
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
7070
let work_dir = test_env.work_dir("repo");
71-
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
71+
let formatter_path = assert_cmd::cargo::cargo_bin!("fake-formatter");
7272
assert!(formatter_path.is_file());
7373
let formatter = to_toml_value(formatter_path.to_str().unwrap());
7474
test_env.add_config(format!(
@@ -111,7 +111,7 @@ fn test_config_multiple_tools_with_same_name() {
111111
let mut test_env = TestEnvironment::default();
112112
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
113113
let work_dir = test_env.work_dir("repo");
114-
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
114+
let formatter_path = assert_cmd::cargo::cargo_bin!("fake-formatter");
115115
assert!(formatter_path.is_file());
116116
let formatter = to_toml_value(formatter_path.to_str().unwrap());
117117

@@ -167,7 +167,7 @@ fn test_config_disabled_tools() {
167167
let test_env = TestEnvironment::default();
168168
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
169169
let work_dir = test_env.work_dir("repo");
170-
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
170+
let formatter_path = assert_cmd::cargo::cargo_bin!("fake-formatter");
171171
assert!(formatter_path.is_file());
172172
let formatter = to_toml_value(formatter_path.to_str().unwrap());
173173
test_env.add_config(format!(
@@ -217,7 +217,7 @@ fn test_config_disabled_tools_warning_when_all_tools_are_disabled() {
217217
let test_env = TestEnvironment::default();
218218
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
219219
let work_dir = test_env.work_dir("repo");
220-
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
220+
let formatter_path = assert_cmd::cargo::cargo_bin!("fake-formatter");
221221
assert!(formatter_path.is_file());
222222
let formatter = to_toml_value(formatter_path.to_str().unwrap());
223223
test_env.add_config(format!(
@@ -246,7 +246,7 @@ fn test_config_tables_overlapping_patterns() {
246246
let test_env = TestEnvironment::default();
247247
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
248248
let work_dir = test_env.work_dir("repo");
249-
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
249+
let formatter_path = assert_cmd::cargo::cargo_bin!("fake-formatter");
250250
assert!(formatter_path.is_file());
251251
let formatter = to_toml_value(formatter_path.to_str().unwrap());
252252

@@ -327,7 +327,7 @@ fn test_config_tables_some_commands_missing() {
327327
let test_env = TestEnvironment::default();
328328
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
329329
let work_dir = test_env.work_dir("repo");
330-
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
330+
let formatter_path = assert_cmd::cargo::cargo_bin!("fake-formatter");
331331
assert!(formatter_path.is_file());
332332
let formatter = to_toml_value(formatter_path.to_str().unwrap());
333333
test_env.add_config(format!(
@@ -367,7 +367,7 @@ fn test_config_tables_empty_patterns_list() {
367367
let test_env = TestEnvironment::default();
368368
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
369369
let work_dir = test_env.work_dir("repo");
370-
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
370+
let formatter_path = assert_cmd::cargo::cargo_bin!("fake-formatter");
371371
assert!(formatter_path.is_file());
372372
let formatter = to_toml_value(formatter_path.to_str().unwrap());
373373
test_env.add_config(format!(
@@ -400,7 +400,7 @@ fn test_config_filesets() {
400400
let test_env = TestEnvironment::default();
401401
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
402402
let work_dir = test_env.work_dir("repo");
403-
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
403+
let formatter_path = assert_cmd::cargo::cargo_bin!("fake-formatter");
404404
assert!(formatter_path.is_file());
405405
let formatter = to_toml_value(formatter_path.to_str().unwrap());
406406
test_env.add_config(format!(
@@ -447,7 +447,7 @@ fn test_relative_paths() {
447447
let test_env = TestEnvironment::default();
448448
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
449449
let work_dir = test_env.work_dir("repo");
450-
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
450+
let formatter_path = assert_cmd::cargo::cargo_bin!("fake-formatter");
451451
assert!(formatter_path.is_file());
452452
let formatter = to_toml_value(formatter_path.to_str().unwrap());
453453
test_env.add_config(format!(
@@ -519,11 +519,11 @@ fn test_relative_tool_path_from_subdirectory() {
519519
let work_dir = test_env.work_dir("repo");
520520

521521
// Copy the fake-formatter into the workspace as a relative tool
522-
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
522+
let formatter_path = assert_cmd::cargo::cargo_bin!("fake-formatter");
523523
let formatter_name = formatter_path.file_name().unwrap().to_str().unwrap();
524524
let tool_dir = work_dir.create_dir("tools");
525525
let workspace_formatter_path = tool_dir.root().join(formatter_name);
526-
std::fs::copy(&formatter_path, &workspace_formatter_path).unwrap();
526+
std::fs::copy(formatter_path, &workspace_formatter_path).unwrap();
527527
work_dir.write_file(".gitignore", "tools/\n");
528528
let formatter_relative_path = PathBuf::from_iter(["$root", "tools", formatter_name]);
529529
test_env.add_config(format!(
@@ -1410,7 +1410,7 @@ fn test_all_files() {
14101410
let test_env = TestEnvironment::default();
14111411
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
14121412
let work_dir = test_env.work_dir("repo");
1413-
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
1413+
let formatter_path = assert_cmd::cargo::cargo_bin!("fake-formatter");
14141414
assert!(formatter_path.is_file());
14151415
let formatter = to_toml_value(formatter_path.to_str().unwrap());
14161416

cli/tests/test_util_command.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ fn test_shell_completions() {
128128
#[test]
129129
fn test_util_exec() {
130130
let test_env = TestEnvironment::default();
131-
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
131+
let formatter_path = assert_cmd::cargo::cargo_bin!("fake-formatter");
132132
let output = test_env.run_jj_in(
133133
".",
134134
[
@@ -147,7 +147,7 @@ fn test_util_exec() {
147147
#[test]
148148
fn test_util_exec_fail() {
149149
let test_env = TestEnvironment::default();
150-
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
150+
let formatter_path = assert_cmd::cargo::cargo_bin!("fake-formatter");
151151
let output = test_env.run_jj_in(
152152
".",
153153
[

0 commit comments

Comments
 (0)