tests: rewrite default-command test to not depend on "show" template

This commit is contained in:
Yuya Nishihara 2023-04-22 12:43:00 +09:00
parent 366cee06c4
commit feeacacb7b

View file

@ -82,20 +82,20 @@ fn test_no_subcommand() {
let stdout = test_env.jj_cmd_success(&repo_path, &[]); let stdout = test_env.jj_cmd_success(&repo_path, &[]);
assert_eq!(stdout, test_env.jj_cmd_success(&repo_path, &["log"])); assert_eq!(stdout, test_env.jj_cmd_success(&repo_path, &["log"]));
let stdout = test_env.jj_cmd_success(&repo_path, &["-T", "show"]); // Command argument that looks like a command name.
let stdout = stdout.lines().skip(2).join("\n"); test_env.jj_cmd_success(&repo_path, &["branch", "create", "help"]);
insta::assert_snapshot!(stdout, @r###" test_env.jj_cmd_success(&repo_path, &["branch", "create", "log"]);
Author: Test User <test.user@example.com> (2001-02-03 04:05:07.000 +07:00) test_env.jj_cmd_success(&repo_path, &["branch", "create", "show"]);
Committer: Test User <test.user@example.com> (2001-02-03 04:05:07.000 +07:00) // TODO: test_env.jj_cmd_success(&repo_path, &["-r", "help"])
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["-r", "log"]), @r###"
(no description set) @ qpvuntsmwlqt test.user@example.com 2001-02-03 04:05:07.000 +07:00 help log show 230dd059e1b0
(empty) (no description set)
Commit ID: 0000000000000000000000000000000000000000 ~
Change ID: zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz "###);
Author: <> (1970-01-01 00:00:00.000 +00:00) insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["-r", "show"]), @r###"
Committer: <> (1970-01-01 00:00:00.000 +00:00) @ qpvuntsmwlqt test.user@example.com 2001-02-03 04:05:07.000 +07:00 help log show 230dd059e1b0
(empty) (no description set)
(no description set) ~
"###); "###);
} }