-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test_abandon_command: add test where a commit is abandoned twice
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,6 +159,42 @@ fn test_rebase_branch_with_merge() { | |
"###); | ||
} | ||
|
||
#[test] | ||
fn test_double_abandon() { | ||
let test_env = TestEnvironment::default(); | ||
test_env.jj_cmd_ok(test_env.env_root(), &["init", "repo", "--git"]); | ||
let repo_path = test_env.env_root().join("repo"); | ||
|
||
create_commit(&test_env, &repo_path, "a", &[]); | ||
// Test the setup | ||
insta::assert_snapshot!( | ||
test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r", "a"]) | ||
, @r###" | ||
rlvkpnrz [email protected] 2001-02-03 04:05:09.000 +07:00 a 2443ea76 | ||
a | ||
"###); | ||
|
||
let commit_id = test_env.jj_cmd_success( | ||
&repo_path, | ||
&["log", "--no-graph", "--color=never", "-T=commit_id", "-r=a"], | ||
); | ||
|
||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["abandon", &commit_id]); | ||
insta::assert_snapshot!(stdout, @""); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Abandoned commit rlvkpnrz 2443ea76 a | a | ||
Working copy now at: royxmykx f37b4afd (empty) (no description set) | ||
Parent commit : zzzzzzzz 00000000 a | (empty) (no description set) | ||
Added 0 files, modified 0 files, removed 1 files | ||
"###); | ||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["abandon", &commit_id]); | ||
insta::assert_snapshot!(stdout, @""); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Abandoned commit rlvkpnrz 2443ea76 a | ||
Nothing changed. | ||
"###); | ||
} | ||
|
||
fn get_log_output(test_env: &TestEnvironment, repo_path: &Path) -> String { | ||
test_env.jj_cmd_success(repo_path, &["log", "-T", "branches"]) | ||
} |