Skip to content

Commit

Permalink
tests: add test for log builtin templates with colors
Browse files Browse the repository at this point in the history
  • Loading branch information
avamsi committed Aug 30, 2023
1 parent 81b620b commit dbf13a5
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions cli/tests/test_commit_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 [38;5;[email protected] 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 [38;5;[email protected] 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 <[38;5;[email protected]> (2001-02-03 04:05:07.000 +07:00)
│ Committer: Test User <[38;5;[email protected]> (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();
Expand Down

0 comments on commit dbf13a5

Please sign in to comment.