tests: add test for log builtin templates with colors

This commit is contained in:
Vamsi Avula 2023-08-30 10:00:20 +05:30
parent 81b620babb
commit dbf13a5250

View file

@ -230,6 +230,72 @@ fn test_log_builtin_templates() {
"###);
}
#[test]
fn test_log_builtin_templates_colored() {
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");
let render =
|template| test_env.jj_cmd_success(&repo_path, &["--color=always", "log", "-T", template]);
test_env.jj_cmd_ok(
&repo_path,
&[
"--config-toml=user.email=''",
"--config-toml=user.name=''",
"new",
],
);
insta::assert_snapshot!(render(r#"builtin_log_oneline"#), @r###"
@ rlvkpnrz (no email set) 2001-02-03 04:05:08.000 +07:00 dc315397 (empty) (no description set)
qpvuntsm test.user 2001-02-03 04:05:07.000 +07:00 230dd059 (empty) (no description set)
zzzzzzzz root 00000000
"###);
insta::assert_snapshot!(render(r#"builtin_log_compact"#), @r###"
@ rlvkpnrz (no email set) 2001-02-03 04:05:08.000 +07:00 dc315397
(empty) (no description set)
qpvuntsm test.user@example.com 2001-02-03 04:05:07.000 +07:00 230dd059
(empty) (no description set)
zzzzzzzz root 00000000
"###);
insta::assert_snapshot!(render(r#"builtin_log_comfortable"#), @r###"
@ rlvkpnrz (no email set) 2001-02-03 04:05:08.000 +07:00 dc315397
(empty) (no description set)
qpvuntsm test.user@example.com 2001-02-03 04:05:07.000 +07:00 230dd059
(empty) (no description set)
zzzzzzzz root 00000000
"###);
insta::assert_snapshot!(render(r#"builtin_log_detailed"#), @r###"
@ Commit ID: dc31539712c7294d1d712cec63cef4504b94ca74
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author: (no name set) <(no email set)> (2001-02-03 04:05:08.000 +07:00)
Committer: (no name set) <(no email set)> (2001-02-03 04:05:08.000 +07:00)
 (no description set)
Commit ID: 230dd059e1b059aefc0da06a2e5a7dbf22362f22
Change ID: qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu
Author: Test User <test.user@example.com> (2001-02-03 04:05:07.000 +07:00)
Committer: Test User <test.user@example.com> (2001-02-03 04:05:07.000 +07:00)
 (no description set)
Commit ID: 0000000000000000000000000000000000000000
Change ID: zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
Author: (no name set) <(no email set)> (1970-01-01 00:00:00.000 +00:00)
Committer: (no name set) <(no email set)> (1970-01-01 00:00:00.000 +00:00)
 (no description set)
"###);
}
#[test]
fn test_log_obslog_divergence() {
let test_env = TestEnvironment::default();