Skip to content

Commit

Permalink
rewrite: fix test cases after adding incomplete() revset
Browse files Browse the repository at this point in the history
  • Loading branch information
scott2000 committed Jun 17, 2024
1 parent 28f4b38 commit 5071365
Show file tree
Hide file tree
Showing 39 changed files with 1,263 additions and 1,257 deletions.
26 changes: 13 additions & 13 deletions cli/tests/test_branch_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ fn test_branch_delete_glob() {
test_env.jj_cmd_ok(&repo_path, &["git", "push", "--all"]);

insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ bar-2 foo-1 foo-3 foo-4 6fbf398c2d59
@ bar-2 foo-1 foo-3 foo-4 312a98d6f27b
◉ 000000000000
"###);
let (stdout, stderr) =
Expand All @@ -343,7 +343,7 @@ fn test_branch_delete_glob() {
Deleted 2 branches.
"###);
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ bar-2 foo-1@origin foo-3@origin foo-4 6fbf398c2d59
@ bar-2 foo-1@origin foo-3@origin foo-4 312a98d6f27b
◉ 000000000000
"###);

Expand All @@ -366,20 +366,20 @@ fn test_branch_delete_glob() {
Warning: --glob has been deprecated. Please prefix the pattern with `glob:` instead.
"###);
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ bar-2 foo-1@origin foo-3@origin foo-4@origin 6fbf398c2d59
@ bar-2 foo-1@origin foo-3@origin foo-4@origin 312a98d6f27b
◉ 000000000000
"###);

// The deleted branches are still there
insta::assert_snapshot!(get_branch_output(&test_env, &repo_path), @r###"
bar-2: qpvuntsm 6fbf398c (empty) commit
@origin: qpvuntsm 6fbf398c (empty) commit
bar-2: qpvuntsm 312a98d6 (empty) commit
@origin: qpvuntsm 312a98d6 (empty) commit
foo-1 (deleted)
@origin: qpvuntsm 6fbf398c (empty) commit
@origin: qpvuntsm 312a98d6 (empty) commit
foo-3 (deleted)
@origin: qpvuntsm 6fbf398c (empty) commit
@origin: qpvuntsm 312a98d6 (empty) commit
foo-4 (deleted)
@origin: qpvuntsm 6fbf398c (empty) commit
@origin: qpvuntsm 312a98d6 (empty) commit
"###);

// Malformed glob
Expand Down Expand Up @@ -849,11 +849,11 @@ fn test_branch_track_conflict() {
);
let (_, stderr) = test_env.jj_cmd_ok(&repo_path, &["branch", "track", "main@origin"]);
insta::assert_snapshot!(stderr, @r###"
main (conflicted):
+ qpvuntsm b4a6b8c5 (empty) b
+ qpvuntsm hidden 4bfd80cd (empty) a
@origin (behind by 1 commits): qpvuntsm hidden 4bfd80cd (empty) a
"###);
main (conflicted):
+ qpvuntsm e802c4f8 (empty) b
+ qpvuntsm hidden 427890ea (empty) a
@origin (behind by 1 commits): qpvuntsm hidden 427890ea (empty) a
"###);
}

#[test]
Expand Down
10 changes: 5 additions & 5 deletions cli/tests/test_builtin_aliases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn test_builtin_alias_trunk_matches_main() {

let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]);
insta::assert_snapshot!(stdout, @r###"
lzmmnrxq test.user@example.com 2001-02-03 08:05:08 main 45a3aa29
xtvrqkyv test.user@example.com 2001-02-03 08:05:08 main d13ecdbd
│ (empty) description 1
~
"###);
Expand All @@ -64,7 +64,7 @@ fn test_builtin_alias_trunk_matches_master() {

let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]);
insta::assert_snapshot!(stdout, @r###"
lzmmnrxq test.user@example.com 2001-02-03 08:05:08 master 45a3aa29
xtvrqkyv test.user@example.com 2001-02-03 08:05:08 master d13ecdbd
│ (empty) description 1
~
"###);
Expand All @@ -76,7 +76,7 @@ fn test_builtin_alias_trunk_matches_trunk() {

let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]);
insta::assert_snapshot!(stdout, @r###"
lzmmnrxq test.user@example.com 2001-02-03 08:05:08 trunk 45a3aa29
xtvrqkyv test.user@example.com 2001-02-03 08:05:08 trunk d13ecdbd
│ (empty) description 1
~
"###);
Expand All @@ -91,7 +91,7 @@ fn test_builtin_alias_trunk_matches_exactly_one_commit() {

let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]);
insta::assert_snapshot!(stdout, @r###"
lzmmnrxq test.user@example.com 2001-02-03 08:05:08 main 45a3aa29
xtvrqkyv test.user@example.com 2001-02-03 08:05:08 main d13ecdbd
│ (empty) description 1
~
"###);
Expand All @@ -107,7 +107,7 @@ fn test_builtin_alias_trunk_override_alias() {

let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]);
insta::assert_snapshot!(stdout, @r###"
lzmmnrxq test.user@example.com 2001-02-03 08:05:08 override-trunk 45a3aa29
xtvrqkyv test.user@example.com 2001-02-03 08:05:08 override-trunk d13ecdbd
│ (empty) description 1
~
"###);
Expand Down
40 changes: 20 additions & 20 deletions cli/tests/test_checkout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ fn test_checkout() {
insta::assert_snapshot!(stderr, @r###"
Warning: `jj checkout` is deprecated; use `jj new` instead, which is equivalent
Warning: `jj checkout` will be removed in a future version, and this will be a hard error
Working copy now at: zsuskuln 05ce7118 (empty) (no description set)
Parent commit : rlvkpnrz 5c52832c (empty) second
Working copy now at: zsuskuln c97da310 (empty) (no description set)
Parent commit : rlvkpnrz 9ed53a4a (empty) second
"###);
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ 05ce7118568d3007efc9163b055f9cb4a6becfde
5c52832c3483e0ace06d047a806024984f28f1d7 second
69542c1984c1f9d91f7c6c9c9e6941782c944bd9 first
@ c97da310c66008034013412d321397242e1e43ef
9ed53a4a1becd028f9a2fe0d5275973acea7e8da second
fa15625b4a986997697639dfc2844138900c79f2 first
◉ 0000000000000000000000000000000000000000
"###);

// Can provide a description
test_env.jj_cmd_ok(&repo_path, &["checkout", "@--", "-m", "my message"]);
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
@ 1191baaf276e3d0b96b1747e885b3a517be80d6f my message
│ ◉ 5c52832c3483e0ace06d047a806024984f28f1d7 second
@ 6f9c4a002224fde4ebc48ce6ec03d5ffcfa64ad2 my message
│ ◉ 9ed53a4a1becd028f9a2fe0d5275973acea7e8da second
├─╯
69542c1984c1f9d91f7c6c9c9e6941782c944bd9 first
fa15625b4a986997697639dfc2844138900c79f2 first
◉ 0000000000000000000000000000000000000000
"###);
}
Expand All @@ -70,11 +70,11 @@ fn test_checkout_not_single_rev() {
Warning: `jj checkout` will be removed in a future version, and this will be a hard error
Error: Revset "root()..@" resolved to more than one revision
Hint: The revset "root()..@" resolved to these revisions:
royxmykx 2f859371 (empty) (no description set)
mzvwutvl 5c1afd8b (empty) fifth
zsuskuln 009f88bf (empty) fourth
kkmpptxz 3fa8931e (empty) third
rlvkpnrz 5c52832c (empty) second
royxmykx 554d2245 (empty) (no description set)
mzvwutvl a497e2bf (empty) fifth
zsuskuln 9d7e5e99 (empty) fourth
kkmpptxz 30056b0c (empty) third
rlvkpnrz 9ed53a4a (empty) second
...
"###);

Expand All @@ -84,11 +84,11 @@ fn test_checkout_not_single_rev() {
Warning: `jj checkout` will be removed in a future version, and this will be a hard error
Error: Revset "root()..@-" resolved to more than one revision
Hint: The revset "root()..@-" resolved to these revisions:
mzvwutvl 5c1afd8b (empty) fifth
zsuskuln 009f88bf (empty) fourth
kkmpptxz 3fa8931e (empty) third
rlvkpnrz 5c52832c (empty) second
qpvuntsm 69542c19 (empty) first
mzvwutvl a497e2bf (empty) fifth
zsuskuln 9d7e5e99 (empty) fourth
kkmpptxz 30056b0c (empty) third
rlvkpnrz 9ed53a4a (empty) second
qpvuntsm fa15625b (empty) first
"###);

let stderr = test_env.jj_cmd_failure(&repo_path, &["checkout", "@-|@--"]);
Expand All @@ -97,8 +97,8 @@ fn test_checkout_not_single_rev() {
Warning: `jj checkout` will be removed in a future version, and this will be a hard error
Error: Revset "@-|@--" resolved to more than one revision
Hint: The revset "@-|@--" resolved to these revisions:
mzvwutvl 5c1afd8b (empty) fifth
zsuskuln 009f88bf (empty) fourth
mzvwutvl a497e2bf (empty) fifth
zsuskuln 9d7e5e99 (empty) fourth
"###);

let stderr = test_env.jj_cmd_failure(&repo_path, &["checkout", "none()"]);
Expand Down
20 changes: 10 additions & 10 deletions cli/tests/test_commit_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ fn test_commit_with_description_from_cli() {
// Description applies to the current working-copy (not the new one)
test_env.jj_cmd_ok(&workspace_path, &["commit", "-m=first"]);
insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r###"
@ b88fb4e51bdd
69542c1984c1 first
@ e8ea92a8b6b3
fa15625b4a98 first
◉ 000000000000
"###);
}
Expand All @@ -44,8 +44,8 @@ fn test_commit_with_editor() {
std::fs::write(&edit_script, ["dump editor0", "write\nmodified"].join("\0")).unwrap();
test_env.jj_cmd_ok(&workspace_path, &["commit"]);
insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r###"
@ 3df78bc2b9b5
30a8c2b3d6eb modified
@ a57b2c95fb75
159271101e05 modified
◉ 000000000000
"###);
insta::assert_snapshot!(
Expand Down Expand Up @@ -136,11 +136,11 @@ fn test_commit_with_default_description() {
std::fs::write(edit_script, ["dump editor"].join("\0")).unwrap();
test_env.jj_cmd_ok(&workspace_path, &["commit"]);

insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r#"
@ 8dc0591d00f7
7e780ba80aeb TESTED=TODO
insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r###"
@ c65242099289
573b6df51aea TESTED=TODO
◉ 000000000000
"#);
"###);
assert_eq!(
std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(),
r#"
Expand Down Expand Up @@ -203,8 +203,8 @@ fn test_commit_paths_warning() {
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_path, &["commit", "-m=first", "file3"]);
insta::assert_snapshot!(stderr, @r###"
Warning: The given paths do not match any file: file3
Working copy now at: rlvkpnrz 67872820 (no description set)
Parent commit : qpvuntsm 69542c19 (empty) first
Working copy now at: rlvkpnrz d1872100 (no description set)
Parent commit : qpvuntsm fa15625b (empty) first
"###);
insta::assert_snapshot!(stdout, @"");

Expand Down
38 changes: 19 additions & 19 deletions cli/tests/test_commit_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn test_log_author_timestamp() {
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "author.timestamp()"]);
insta::assert_snapshot!(stdout, @r###"
@ 2001-02-03 04:05:09.000 +07:00
◉ 2001-02-03 04:05:07.000 +07:00
◉ 2001-02-03 04:05:08.000 +07:00
◉ 1970-01-01 00:00:00.000 +00:00
"###);
}
Expand Down Expand Up @@ -189,29 +189,29 @@ fn test_log_default() {
// Test default log output format
let stdout = test_env.jj_cmd_success(&repo_path, &["log"]);
insta::assert_snapshot!(stdout, @r###"
@ kkmpptxz test.user@example.com 2001-02-03 08:05:09 my-branch 9de54178
@ kkmpptxz test.user@example.com 2001-02-03 08:05:09 my-branch bac9ff9e
│ (empty) description 1
◉ qpvuntsm test.user@example.com 2001-02-03 08:05:08 4291e264
◉ qpvuntsm test.user@example.com 2001-02-03 08:05:08 aa2015d7
│ add a file
◉ zzzzzzzz root() 00000000
"###);

// Color
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]);
insta::assert_snapshot!(stdout, @r###"
@ [1m[38;5;13mk[38;5;8mkmpptxz[39m [38;5;3mtest.user@example.com[39m [38;5;14m2001-02-03 08:05:09[39m [38;5;13mmy-branch[39m [38;5;12m9[38;5;8mde54178[39m[0m
@ [1m[38;5;13mk[38;5;8mkmpptxz[39m [38;5;3mtest.user@example.com[39m [38;5;14m2001-02-03 08:05:09[39m [38;5;13mmy-branch[39m [38;5;12mb[38;5;8mac9ff9e[39m[0m
│ (empty) description 1
◉ [1m[38;5;5mq[0m[38;5;8mpvuntsm[39m [38;5;3mtest.user@example.com[39m [38;5;6m2001-02-03 08:05:08[39m [1m[38;5;4m4[0m[38;5;8m291e264[39m
◉ [1m[38;5;5mq[0m[38;5;8mpvuntsm[39m [38;5;3mtest.user@example.com[39m [38;5;6m2001-02-03 08:05:08[39m [1m[38;5;4ma[0m[38;5;8ma2015d7[39m
│ add a file
◉ zzzzzzzz root() 00000000
"###);

// Color without graph
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always", "--no-graph"]);
insta::assert_snapshot!(stdout, @r###"
[1m[38;5;13mk[38;5;8mkmpptxz[39m [38;5;3mtest.user@example.com[39m [38;5;14m2001-02-03 08:05:09[39m [38;5;13mmy-branch[39m [38;5;12m9[38;5;8mde54178[39m[0m
[1m[38;5;13mk[38;5;8mkmpptxz[39m [38;5;3mtest.user@example.com[39m [38;5;14m2001-02-03 08:05:09[39m [38;5;13mmy-branch[39m [38;5;12mb[38;5;8mac9ff9e[39m[0m
(empty) description 1
[1m[38;5;5mq[0m[38;5;8mpvuntsm[39m [38;5;3mtest.user@example.com[39m [38;5;6m2001-02-03 08:05:08[39m [1m[38;5;4m4[0m[38;5;8m291e264[39m
[1m[38;5;5mq[0m[38;5;8mpvuntsm[39m [38;5;3mtest.user@example.com[39m [38;5;6m2001-02-03 08:05:08[39m [1m[38;5;4ma[0m[38;5;8ma2015d7[39m
add a file
zzzzzzzz root() 00000000
"###);
Expand Down Expand Up @@ -440,7 +440,7 @@ fn test_log_obslog_divergence() {
let stdout = test_env.jj_cmd_success(&repo_path, &["log"]);
// No divergence
insta::assert_snapshot!(stdout, @r###"
@ qpvuntsm test.user@example.com 2001-02-03 08:05:08 7a17d52e
@ qpvuntsm test.user@example.com 2001-02-03 08:05:08 ff309c29
│ description 1
◉ zzzzzzzz root() 00000000
"###);
Expand All @@ -452,9 +452,9 @@ fn test_log_obslog_divergence() {
);
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log"]);
insta::assert_snapshot!(stdout, @r###"
◉ qpvuntsm?? test.user@example.com 2001-02-03 08:05:10 8979953d
◉ qpvuntsm?? test.user@example.com 2001-02-03 08:05:10 6ba70e00
│ description 2
│ @ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 7a17d52e
│ @ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29
├─╯ description 1
◉ zzzzzzzz root() 00000000
"###);
Expand All @@ -465,19 +465,19 @@ fn test_log_obslog_divergence() {
// Color
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]);
insta::assert_snapshot!(stdout, @r###"
◉ [1m[4m[38;5;1mq[0m[38;5;1mpvuntsm??[39m [38;5;3mtest.user@example.com[39m [38;5;6m2001-02-03 08:05:10[39m [1m[38;5;4m8[0m[38;5;8m979953d[39m
◉ [1m[4m[38;5;1mq[0m[38;5;1mpvuntsm??[39m [38;5;3mtest.user@example.com[39m [38;5;6m2001-02-03 08:05:10[39m [1m[38;5;4m6[0m[38;5;8mba70e00[39m
│ description 2
│ @ [1m[4m[38;5;1mq[24mpvuntsm[38;5;9m??[39m [38;5;3mtest.user@example.com[39m [38;5;14m2001-02-03 08:05:08[39m [38;5;12m7[38;5;8ma17d52e[39m[0m
│ @ [1m[4m[38;5;1mq[24mpvuntsm[38;5;9m??[39m [38;5;3mtest.user@example.com[39m [38;5;14m2001-02-03 08:05:08[39m [38;5;12mf[38;5;8mf309c29[39m[0m
├─╯ description 1
◉ zzzzzzzz root() 00000000
"###);

// Obslog and hidden divergent
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog"]);
insta::assert_snapshot!(stdout, @r###"
@ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 7a17d52e
@ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29
│ description 1
◉ qpvuntsm hidden test.user@example.com 2001-02-03 08:05:08 3b68ce25
◉ qpvuntsm hidden test.user@example.com 2001-02-03 08:05:08 485d52a9
│ (no description set)
◉ qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059
(empty) (no description set)
Expand All @@ -486,9 +486,9 @@ fn test_log_obslog_divergence() {
// Colored obslog
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog", "--color=always"]);
insta::assert_snapshot!(stdout, @r###"
@ [1m[4m[38;5;1mq[24mpvuntsm[38;5;9m??[39m [38;5;3mtest.user@example.com[39m [38;5;14m2001-02-03 08:05:08[39m [38;5;12m7[38;5;8ma17d52e[39m[0m
@ [1m[4m[38;5;1mq[24mpvuntsm[38;5;9m??[39m [38;5;3mtest.user@example.com[39m [38;5;14m2001-02-03 08:05:08[39m [38;5;12mf[38;5;8mf309c29[39m[0m
│ description 1
◉ [1m[39mq[0m[38;5;8mpvuntsm[39m hidden [38;5;3mtest.user@example.com[39m [38;5;6m2001-02-03 08:05:08[39m [1m[38;5;4m3[0m[38;5;8mb68ce25[39m
◉ [1m[39mq[0m[38;5;8mpvuntsm[39m hidden [38;5;3mtest.user@example.com[39m [38;5;6m2001-02-03 08:05:08[39m [1m[38;5;4m4[0m[38;5;8m85d52a9[39m
│ (no description set)
◉ qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059
(empty) (no description set)
Expand Down Expand Up @@ -548,7 +548,7 @@ fn test_log_branches() {
◉ fed794e2ba44 branch3?? branch3@origin
│ ◉ b1bb3766d584 branch3??
├─╯
│ ◉ 21c33875443e branch1*
│ ◉ 28ff13ce7195 branch1*
├─╯
│ @ a5b4d15489cc branch2* new-branch
│ ◉ 8476341eb395 branch2@origin unchanged
Expand Down Expand Up @@ -658,7 +658,7 @@ fn test_log_customize_short_id() {
],
);
insta::assert_snapshot!(stdout, @r###"
@ Q_pvun test.user@example.com 2001-02-03 08:05:08 6_9542
@ Q_pvun test.user@example.com 2001-02-03 08:05:08 F_a156
│ (empty) first
◉ Z_zzzz root() 0_0000
"###);
Expand All @@ -676,7 +676,7 @@ fn test_log_customize_short_id() {
],
);
insta::assert_snapshot!(stdout, @r###"
@ QPVUNTSM test.user@example.com 2001-02-03 08:05:08 69542c19
@ QPVUNTSM test.user@example.com 2001-02-03 08:05:08 fa15625b
│ (empty) first
◉ ZZZZZZZZ root() 00000000
"###);
Expand Down
Loading

0 comments on commit 5071365

Please sign in to comment.