diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 3a5313796..9fb710dc1 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -156,6 +156,7 @@ impl TestEnvironment { .as_bytes(), ); let edit_script = self.env_root().join("edit_script"); + std::fs::write(&edit_script, "").unwrap(); self.add_env_var("EDIT_SCRIPT", edit_script.to_str().unwrap()); edit_script } @@ -178,6 +179,7 @@ impl TestEnvironment { .as_bytes(), ); let edit_script = self.env_root().join("diff_edit_script"); + std::fs::write(&edit_script, "").unwrap(); self.add_env_var("DIFF_EDIT_SCRIPT", edit_script.to_str().unwrap()); edit_script } diff --git a/tests/test_diffedit_command.rs b/tests/test_diffedit_command.rs index 7d3cb8e63..fe3b9be50 100644 --- a/tests/test_diffedit_command.rs +++ b/tests/test_diffedit_command.rs @@ -184,7 +184,6 @@ fn test_diffedit_old_restore_interactive_tests() { let edit_script = test_env.set_up_fake_diff_editor(); // Nothing happens if we make no changes - std::fs::write(&edit_script, "").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["diffedit", "--from", "@-"]); insta::assert_snapshot!(stdout, @r###" Nothing changed. diff --git a/tests/test_move_command.rs b/tests/test_move_command.rs index 450e8f0dc..9cc952068 100644 --- a/tests/test_move_command.rs +++ b/tests/test_move_command.rs @@ -198,7 +198,6 @@ fn test_move_partial() { let edit_script = test_env.set_up_fake_diff_editor(); // If we don't make any changes in the diff-editor, the whole change is moved - std::fs::write(&edit_script, "").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["move", "-i", "--from", "c"]); insta::assert_snapshot!(stdout, @r###" Working copy now at: 71b69e433fbc (no description set) diff --git a/tests/test_squash_command.rs b/tests/test_squash_command.rs index a9e5e2d8b..a07e3914e 100644 --- a/tests/test_squash_command.rs +++ b/tests/test_squash_command.rs @@ -153,7 +153,6 @@ fn test_squash_partial() { // If we don't make any changes in the diff-editor, the whole change is moved // into the parent let edit_script = test_env.set_up_fake_diff_editor(); - std::fs::write(&edit_script, "").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["squash", "-r", "b", "-i"]); insta::assert_snapshot!(stdout, @r###" Rebased 1 descendant commits diff --git a/tests/test_unsquash_command.rs b/tests/test_unsquash_command.rs index 75ddb52e7..681e4e4ee 100644 --- a/tests/test_unsquash_command.rs +++ b/tests/test_unsquash_command.rs @@ -151,7 +151,6 @@ fn test_unsquash_partial() { // If we don't make any changes in the diff-editor, the whole change is moved // from the parent let edit_script = test_env.set_up_fake_diff_editor(); - std::fs::write(&edit_script, "").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["unsquash", "-r", "b", "-i"]); insta::assert_snapshot!(stdout, @r###" Rebased 1 descendant commits @@ -170,7 +169,7 @@ fn test_unsquash_partial() { // Can unsquash only some changes in interactive mode test_env.jj_cmd_success(&repo_path, &["undo"]); - std::fs::write(&edit_script, "reset file1").unwrap(); + std::fs::write(edit_script, "reset file1").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["unsquash", "-i"]); insta::assert_snapshot!(stdout, @r###" Working copy now at: a8e8fded1021 (no description set)