Move a test from test_log_command to test_commit_template

This commit is contained in:
Ilya Grigoriev 2023-01-09 22:16:47 -08:00
parent cef5e8795c
commit a43c47a28c
2 changed files with 19 additions and 13 deletions

View File

@ -52,17 +52,33 @@ fn test_log_author_timestamp_ago() {
}
#[test]
fn test_log_default_colors() {
fn test_log_default() {
let test_env = TestEnvironment::default();
test_env.jj_cmd_success(test_env.env_root(), &["init", "repo", "--git"]);
let repo_path = test_env.env_root().join("repo");
test_env.jj_cmd_success(&repo_path, &["describe", "-m", "description 1"]);
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
test_env.jj_cmd_success(&repo_path, &["describe", "-m", "add a file"]);
test_env.jj_cmd_success(&repo_path, &["new", "-m", "description 1"]);
test_env.jj_cmd_success(&repo_path, &["branch", "create", "my-branch"]);
// Test default log output format
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["log"]), @r###"
@ ffdaa62087a2 test.user@example.com 2001-02-03 04:05:09.000 +07:00 my-branch 9de54178d59d
| description 1
o 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:08.000 +07:00 4291e264ae97
| add a file
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(no description set)
"###);
// Color
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]);
insta::assert_snapshot!(stdout, @r###"
@ 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:08.000 +07:00 my-branch 45a3aa29e907
@ ffdaa62087a2 test.user@example.com 2001-02-03 04:05:09.000 +07:00 my-branch 9de54178d59d
| description 1
o 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:08.000 +07:00 4291e264ae97
| add a file
o 000000000000  1970-01-01 00:00:00.000 +00:00 000000000000
(no description set)
"###);

View File

@ -60,16 +60,6 @@ fn test_log_with_or_without_diff() {
o (no description set)
"###);
// Test default log output format
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["log"]), @r###"
@ ffdaa62087a2 test.user@example.com 2001-02-03 04:05:10.000 +07:00 789e536fd2e0
| a new commit
o 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:08.000 +07:00 4291e264ae97
| add a file
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(no description set)
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "--no-graph"]);
insta::assert_snapshot!(stdout, @r###"
a new commit