mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-31 16:40:22 +00:00
tests: add test for moving branch forward and backward
This commit is contained in:
parent
b11f7eee1b
commit
a6aa8aa4f4
1 changed files with 32 additions and 0 deletions
|
@ -80,6 +80,38 @@ fn test_branch_empty_name() {
|
|||
"###);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_branch_move() {
|
||||
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");
|
||||
|
||||
let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["branch", "create", "foo"]);
|
||||
insta::assert_snapshot!(stderr, @"");
|
||||
|
||||
test_env.jj_cmd_ok(&repo_path, &["new"]);
|
||||
let stderr = test_env.jj_cmd_failure(&repo_path, &["branch", "create", "foo"]);
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
Error: Branch already exists: foo
|
||||
Hint: Use `jj branch set` to update it.
|
||||
"###);
|
||||
|
||||
let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["branch", "set", "foo"]);
|
||||
insta::assert_snapshot!(stderr, @"");
|
||||
|
||||
let stderr = test_env.jj_cmd_failure(&repo_path, &["branch", "set", "-r@-", "foo"]);
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
Error: Refusing to move branch backwards or sideways.
|
||||
Hint: Use --allow-backwards to allow it.
|
||||
"###);
|
||||
|
||||
let (_stdout, stderr) = test_env.jj_cmd_ok(
|
||||
&repo_path,
|
||||
&["branch", "set", "-r@-", "--allow-backwards", "foo"],
|
||||
);
|
||||
insta::assert_snapshot!(stderr, @"");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_branch_forget_glob() {
|
||||
let test_env = TestEnvironment::default();
|
||||
|
|
Loading…
Reference in a new issue