From 9de06881636cc27e04303ce917298da532e34a7d Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Mon, 4 Mar 2024 21:26:31 -0800 Subject: [PATCH] tests: avoid deprecated `jj co` --- cli/tests/test_diffedit_command.rs | 2 +- cli/tests/test_git_colocated.rs | 2 +- cli/tests/test_git_push.rs | 4 ++-- cli/tests/test_next_prev_commands.rs | 18 +++++++++--------- cli/tests/test_squash_command.rs | 2 +- cli/tests/test_unsquash_command.rs | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cli/tests/test_diffedit_command.rs b/cli/tests/test_diffedit_command.rs index 891a3f2ffe..0d69b01286 100644 --- a/cli/tests/test_diffedit_command.rs +++ b/cli/tests/test_diffedit_command.rs @@ -352,7 +352,7 @@ fn test_diffedit_merge() { test_env.jj_cmd_ok(&repo_path, &["branch", "create", "b"]); std::fs::write(repo_path.join("file1"), "b\n").unwrap(); std::fs::write(repo_path.join("file2"), "b\n").unwrap(); - test_env.jj_cmd_ok(&repo_path, &["co", "@-"]); + test_env.jj_cmd_ok(&repo_path, &["new", "@-"]); test_env.jj_cmd_ok(&repo_path, &["new"]); std::fs::write(repo_path.join("file1"), "c\n").unwrap(); std::fs::write(repo_path.join("file2"), "c\n").unwrap(); diff --git a/cli/tests/test_git_colocated.rs b/cli/tests/test_git_colocated.rs index 3cc281c6a2..b518ea7495 100644 --- a/cli/tests/test_git_colocated.rs +++ b/cli/tests/test_git_colocated.rs @@ -452,7 +452,7 @@ fn test_git_colocated_checkout_non_empty_working_copy() { std::fs::write(workspace_root.join("two"), "y").unwrap(); test_env.jj_cmd_ok(&workspace_root, &["describe", "-m", "two"]); - test_env.jj_cmd_ok(&workspace_root, &["co", "@-"]); + test_env.jj_cmd_ok(&workspace_root, &["new", "@-"]); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["describe", "-m", "new"]); insta::assert_snapshot!(stderr, @r###" Working copy now at: kkmpptxz 4c049607 (empty) new diff --git a/cli/tests/test_git_push.rs b/cli/tests/test_git_push.rs index 8fedaf6a44..612b3ce769 100644 --- a/cli/tests/test_git_push.rs +++ b/cli/tests/test_git_push.rs @@ -75,7 +75,7 @@ fn test_git_push_current_branch() { &workspace_root, &["describe", "branch1", "-m", "modified branch1 commit"], ); - test_env.jj_cmd_ok(&workspace_root, &["co", "branch2"]); + test_env.jj_cmd_ok(&workspace_root, &["new", "branch2"]); test_env.jj_cmd_ok(&workspace_root, &["branch", "set", "branch2"]); test_env.jj_cmd_ok(&workspace_root, &["branch", "create", "my-branch"]); test_env.jj_cmd_ok(&workspace_root, &["describe", "-m", "foo"]); @@ -149,7 +149,7 @@ fn test_git_push_no_matching_branch() { #[test] fn test_git_push_matching_branch_unchanged() { let (test_env, workspace_root) = set_up(); - test_env.jj_cmd_ok(&workspace_root, &["co", "branch1"]); + test_env.jj_cmd_ok(&workspace_root, &["new", "branch1"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" diff --git a/cli/tests/test_next_prev_commands.rs b/cli/tests/test_next_prev_commands.rs index c42c882953..b75a0447aa 100644 --- a/cli/tests/test_next_prev_commands.rs +++ b/cli/tests/test_next_prev_commands.rs @@ -121,7 +121,7 @@ fn test_next_fails_on_merge_commit() { let repo_path = test_env.env_root().join("repo"); test_env.jj_cmd_ok(&repo_path, &["branch", "c", "left"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "first"]); - test_env.jj_cmd_ok(&repo_path, &["co", "@--"]); + test_env.jj_cmd_ok(&repo_path, &["new", "@--"]); test_env.jj_cmd_ok(&repo_path, &["branch", "c", "right"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "second"]); test_env.jj_cmd_ok(&repo_path, &["new", "left", "right"]); @@ -139,9 +139,9 @@ fn test_next_fails_on_branching_children_no_stdin() { let repo_path = test_env.env_root().join("repo"); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "first"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "second"]); - test_env.jj_cmd_ok(&repo_path, &["co", "@--"]); + test_env.jj_cmd_ok(&repo_path, &["new", "@--"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "third"]); - test_env.jj_cmd_ok(&repo_path, &["co", "@--"]); + test_env.jj_cmd_ok(&repo_path, &["new", "@--"]); // Try to advance the working copy commit. let assert = test_env.jj_cmd(&repo_path, &["next"]).assert().code(1); @@ -158,9 +158,9 @@ fn test_next_fails_on_branching_children_quit_prompt() { let repo_path = test_env.env_root().join("repo"); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "first"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "second"]); - test_env.jj_cmd_ok(&repo_path, &["co", "@--"]); + test_env.jj_cmd_ok(&repo_path, &["new", "@--"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "third"]); - test_env.jj_cmd_ok(&repo_path, &["co", "@--"]); + test_env.jj_cmd_ok(&repo_path, &["new", "@--"]); // Try to advance the working copy commit. let assert = test_env @@ -188,9 +188,9 @@ fn test_next_choose_branching_child() { let repo_path = test_env.env_root().join("repo"); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "first"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "second"]); - test_env.jj_cmd_ok(&repo_path, &["co", "@--"]); + test_env.jj_cmd_ok(&repo_path, &["new", "@--"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "third"]); - test_env.jj_cmd_ok(&repo_path, &["co", "@--"]); + test_env.jj_cmd_ok(&repo_path, &["new", "@--"]); // Advance the working copy commit. let (stdout, stderr) = test_env.jj_cmd_stdin_ok(&repo_path, &["next"], "1\n"); insta::assert_snapshot!(stdout,@r###" @@ -213,7 +213,7 @@ fn test_prev_fails_on_merge_commit() { let repo_path = test_env.env_root().join("repo"); test_env.jj_cmd_ok(&repo_path, &["branch", "c", "left"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "first"]); - test_env.jj_cmd_ok(&repo_path, &["co", "@--"]); + test_env.jj_cmd_ok(&repo_path, &["new", "@--"]); test_env.jj_cmd_ok(&repo_path, &["branch", "c", "right"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "second"]); test_env.jj_cmd_ok(&repo_path, &["new", "left", "right"]); @@ -231,7 +231,7 @@ fn test_prev_fails_on_multiple_parents() { let repo_path = test_env.env_root().join("repo"); test_env.jj_cmd_ok(&repo_path, &["branch", "c", "left"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "first"]); - test_env.jj_cmd_ok(&repo_path, &["co", "@--"]); + test_env.jj_cmd_ok(&repo_path, &["new", "@--"]); test_env.jj_cmd_ok(&repo_path, &["branch", "c", "right"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "second"]); // Create a merge commit, which has two parents. diff --git a/cli/tests/test_squash_command.rs b/cli/tests/test_squash_command.rs index a37b09ed9e..01209db94f 100644 --- a/cli/tests/test_squash_command.rs +++ b/cli/tests/test_squash_command.rs @@ -104,7 +104,7 @@ fn test_squash() { "###); // Can squash into a merge commit - test_env.jj_cmd_ok(&repo_path, &["co", "e"]); + test_env.jj_cmd_ok(&repo_path, &["new", "e"]); std::fs::write(repo_path.join("file1"), "e\n").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["squash"]); insta::assert_snapshot!(stdout, @""); diff --git a/cli/tests/test_unsquash_command.rs b/cli/tests/test_unsquash_command.rs index f130c070e1..3026882883 100644 --- a/cli/tests/test_unsquash_command.rs +++ b/cli/tests/test_unsquash_command.rs @@ -103,7 +103,7 @@ fn test_unsquash() { "###); // Can unsquash from a merge commit - test_env.jj_cmd_ok(&repo_path, &["co", "e"]); + test_env.jj_cmd_ok(&repo_path, &["new", "e"]); std::fs::write(repo_path.join("file1"), "e\n").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["unsquash"]); insta::assert_snapshot!(stdout, @"");