From feeacacb7b33cf60333c679dc3dd9b85fdd2d7ce Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sat, 22 Apr 2023 12:43:00 +0900 Subject: [PATCH] tests: rewrite default-command test to not depend on "show" template --- tests/test_global_opts.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/test_global_opts.rs b/tests/test_global_opts.rs index 035893047..3a384ef3e 100644 --- a/tests/test_global_opts.rs +++ b/tests/test_global_opts.rs @@ -82,20 +82,20 @@ fn test_no_subcommand() { let stdout = test_env.jj_cmd_success(&repo_path, &[]); assert_eq!(stdout, test_env.jj_cmd_success(&repo_path, &["log"])); - let stdout = test_env.jj_cmd_success(&repo_path, &["-T", "show"]); - let stdout = stdout.lines().skip(2).join("\n"); - insta::assert_snapshot!(stdout, @r###" - │ Author: Test User (2001-02-03 04:05:07.000 +07:00) - │ Committer: Test User (2001-02-03 04:05:07.000 +07:00) - │ - │ (no description set) - │ - ◉ Commit ID: 0000000000000000000000000000000000000000 - Change ID: zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz - Author: <> (1970-01-01 00:00:00.000 +00:00) - Committer: <> (1970-01-01 00:00:00.000 +00:00) - - (no description set) + // Command argument that looks like a command name. + test_env.jj_cmd_success(&repo_path, &["branch", "create", "help"]); + test_env.jj_cmd_success(&repo_path, &["branch", "create", "log"]); + test_env.jj_cmd_success(&repo_path, &["branch", "create", "show"]); + // TODO: test_env.jj_cmd_success(&repo_path, &["-r", "help"]) + insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["-r", "log"]), @r###" + @ qpvuntsmwlqt test.user@example.com 2001-02-03 04:05:07.000 +07:00 help log show 230dd059e1b0 + │ (empty) (no description set) + ~ + "###); + insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["-r", "show"]), @r###" + @ qpvuntsmwlqt test.user@example.com 2001-02-03 04:05:07.000 +07:00 help log show 230dd059e1b0 + │ (empty) (no description set) + ~ "###); }