Skip to content

Commit

Permalink
Update all the tests, added one new, fixed template test issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
algmyr committed Apr 13, 2024
1 parent a56c7f5 commit aee6253
Show file tree
Hide file tree
Showing 38 changed files with 1,612 additions and 1,554 deletions.
104 changes: 52 additions & 52 deletions cli/tests/test_abandon_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ fn test_basics() {
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ [znk] e
├─╮
[vru] d
[roy] c
│ │ [zsu] b
[vru] d
[roy] c
│ │ [zsu] b
├───╯
│ [rlv] a
│ [rlv] a
├─╯
[zzz]
[zzz]
"###);

let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["abandon", "d"]);
Expand All @@ -65,12 +65,12 @@ fn test_basics() {
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ [znk] e
├─╮
[roy] c d
│ │ [zsu] b
[roy] c d
│ │ [zsu] b
├───╯
│ [rlv] a
│ [rlv] a
├─╯
[zzz]
[zzz]
"###);

test_env.jj_cmd_ok(&repo_path, &["undo"]);
Expand All @@ -84,13 +84,13 @@ fn test_basics() {
"###);
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ [nkm]
[zsu] b
[zsu] b
├─╯
[rlv] a e??
[vru] d e??
[roy] c
[rlv] a e??
[vru] d e??
[roy] c
├─╯
[zzz]
[zzz]
"###);

test_env.jj_cmd_ok(&repo_path, &["undo"]);
Expand All @@ -107,10 +107,10 @@ fn test_basics() {
"###);
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ [xtn]
[zsu] b
[zsu] b
├─╯
[rlv] a e??
[zzz] c d e??
[rlv] a e??
[zzz] c d e??
"###);

// Test abandoning the same commit twice directly
Expand All @@ -123,11 +123,11 @@ fn test_basics() {
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ [znk] e
├─╮
[vru] d
[roy] c
│ [rlv] a b
[vru] d
[roy] c
│ [rlv] a b
├─╯
[zzz]
[zzz]
"###);

// Test abandoning the same commit twice indirectly
Expand All @@ -146,9 +146,9 @@ fn test_basics() {
"###);
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ [xlz]
[roy] c d e??
[roy] c d e??
├─╯
[zzz] a b e??
[zzz] a b e??
"###);

let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["abandon", "none()"]);
Expand Down Expand Up @@ -177,13 +177,13 @@ fn test_bug_2600() {
// Test the setup
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ [znk] c
[vru] b
[vru] b
├─╮
[roy] a
[roy] a
├─╯
[zsu] base
[rlv] nottherootcommit
[zzz]
[zsu] base
[rlv] nottherootcommit
[zzz]
"###);
let setup_opid = test_env.current_operation_id(&repo_path);

Expand All @@ -201,12 +201,12 @@ fn test_bug_2600() {
// should keep "a" as second parent.
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ [znk] c
[vru] b
[vru] b
├─╮
[roy] a
[roy] a
├─╯
[rlv] base nottherootcommit
[zzz]
[rlv] base nottherootcommit
[zzz]
"###);

test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
Expand All @@ -224,10 +224,10 @@ fn test_bug_2600() {
// "a".
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ [znk] c
[vru] b
[zsu] a base
[rlv] nottherootcommit
[zzz]
[vru] b
[zsu] a base
[rlv] nottherootcommit
[zzz]
"###);

test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
Expand All @@ -245,24 +245,24 @@ fn test_bug_2600() {
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ [znk] c
├─╮
[roy] a b??
[roy] a b??
├─╯
[zsu] b?? base
[rlv] nottherootcommit
[zzz]
[zsu] b?? base
[rlv] nottherootcommit
[zzz]
"###);

test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
// ========= Reminder of the setup ===========
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ [znk] c
[vru] b
[vru] b
├─╮
[roy] a
[roy] a
├─╯
[zsu] base
[rlv] nottherootcommit
[zzz]
[zsu] base
[rlv] nottherootcommit
[zzz]
"###);
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["abandon", "a", "b"]);
insta::assert_snapshot!(stdout, @"");
Expand All @@ -279,9 +279,9 @@ fn test_bug_2600() {
// not have two parent pointers to the same commit.
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ [znk] c
[zsu] a b base
[rlv] nottherootcommit
[zzz]
[zsu] a b base
[rlv] nottherootcommit
[zzz]
"###);
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["branch", "list", "b"]);
insta::assert_snapshot!(stdout, @r###"
Expand All @@ -305,12 +305,12 @@ fn test_bug_2600_rootcommit_special_case() {
// Setup
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ [vru] c
[roy] b
[roy] b
├─╮
[zsu] a
[zsu] a
├─╯
[rlv] base
[zzz]
[rlv] base
[zzz]
"###);

// Now, the test
Expand Down
14 changes: 7 additions & 7 deletions cli/tests/test_alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ fn test_alias_cannot_override_builtin() {
// Alias should be ignored
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "root()"]);
insta::assert_snapshot!(stdout, @r###"
zzzzzzzz root() 00000000
zzzzzzzz root() 00000000
"###);
}

Expand Down Expand Up @@ -206,28 +206,28 @@ fn test_alias_global_args_before_and_after() {
let stdout = test_env.jj_cmd_success(&repo_path, &["l"]);
insta::assert_snapshot!(stdout, @r###"
@ 230dd059e1b059aefc0da06a2e5a7dbf22362f22
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
"###);

// Can pass global args before
let stdout = test_env.jj_cmd_success(&repo_path, &["l", "--at-op", "@-"]);
insta::assert_snapshot!(stdout, @r###"
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
"###);
// Can pass global args after
let stdout = test_env.jj_cmd_success(&repo_path, &["--at-op", "@-", "l"]);
insta::assert_snapshot!(stdout, @r###"
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
"###);
// Test passing global args both before and after
let stdout = test_env.jj_cmd_success(&repo_path, &["--at-op", "abc123", "l", "--at-op", "@-"]);
insta::assert_snapshot!(stdout, @r###"
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["-R", "../nonexistent", "l", "-R", "."]);
insta::assert_snapshot!(stdout, @r###"
@ 230dd059e1b059aefc0da06a2e5a7dbf22362f22
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
"###);
}

Expand All @@ -243,7 +243,7 @@ fn test_alias_global_args_in_definition() {
// The global argument in the alias is respected
let stdout = test_env.jj_cmd_success(&repo_path, &["l"]);
insta::assert_snapshot!(stdout, @r###"
[38;5;4m0000000000000000000000000000000000000000[39m
[1m[38;5;14m◆[0m [38;5;4m0000000000000000000000000000000000000000[39m
"###);
}

Expand Down
Loading

0 comments on commit aee6253

Please sign in to comment.