Skip to content

Commit

Permalink
tests: leverage "squash -m" in obslog test
Browse files Browse the repository at this point in the history
  • Loading branch information
yuja committed Aug 7, 2024
1 parent 92ba6d3 commit c99f502
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions cli/tests/test_obslog_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ fn test_obslog_word_wrap() {

#[test]
fn test_obslog_squash() {
let mut test_env = TestEnvironment::default();
let test_env = TestEnvironment::default();
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
let repo_path = test_env.env_root().join("repo");

Expand All @@ -234,15 +234,12 @@ fn test_obslog_squash() {
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "second"]);
std::fs::write(repo_path.join("file1"), "foo\nbar\n").unwrap();

let edit_script = test_env.set_up_fake_editor();
std::fs::write(&edit_script, "write\nsquashed 1").unwrap();
test_env.jj_cmd_ok(&repo_path, &["squash"]);
test_env.jj_cmd_ok(&repo_path, &["squash", "-m", "squashed 1"]);

test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "third"]);
std::fs::write(repo_path.join("file1"), "foo\nbar\nbaz\n").unwrap();

std::fs::write(&edit_script, "write\nsquashed 2").unwrap();
test_env.jj_cmd_ok(&repo_path, &["squash"]);
test_env.jj_cmd_ok(&repo_path, &["squash", "-m", "squashed 2"]);

let stdout = test_env.jj_cmd_success(&repo_path, &["obslog", "-p", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r###"
Expand Down

0 comments on commit c99f502

Please sign in to comment.