Skip to content

Commit

Permalink
tests: avoid deprecated jj co
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvonz committed Mar 5, 2024
1 parent 1a7c793 commit 6c7b5a1
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cli/tests/test_diffedit_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/test_git_colocated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cli/tests/test_git_push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down Expand Up @@ -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###"
Expand Down
18 changes: 9 additions & 9 deletions cli/tests/test_next_prev_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand All @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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###"
Expand All @@ -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"]);
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/test_squash_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, @"");
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/test_unsquash_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, @"");
Expand Down

0 comments on commit 6c7b5a1

Please sign in to comment.