tests: rerun commit.diff() template test with --color=debug

The added test shows the "diff" label is repeated because of auto-labeling of
templater. The original "--color=always" test is also kept to ensure that color
sequences are unchanged even if we remove one of the "diff" labels.
This commit is contained in:
Yuya Nishihara 2024-07-31 17:41:13 +09:00
parent 052f022479
commit 07b0b0676d

View file

@ -1008,6 +1008,46 @@ fn test_log_diff_predefined_formats() {
M file2
"###);
// color labels
let stdout = test_env.jj_cmd_success(
&repo_path,
&["log", "--no-graph", "--color=debug", "-r@", "-T", template],
);
insta::assert_snapshot!(stdout, @r###"
<<log::=== color_words ===>>
<<log diff color_words diff header::Modified regular file file1:>>
<<log diff color_words diff removed line_number:: 1>><<log diff color_words diff:: >><<log diff color_words diff added line_number:: 1>><<log diff color_words diff::: a>>
<<log diff color_words diff removed line_number:: 2>><<log diff color_words diff:: >><<log diff color_words diff added line_number:: 2>><<log diff color_words diff::: b>>
<<log diff color_words diff:: >><<log diff color_words diff added line_number:: 3>><<log diff color_words diff::: >><<log diff color_words diff added token::c>>
<<log diff color_words diff header::Modified regular file file2:>>
<<log diff color_words diff removed line_number:: 1>><<log diff color_words diff:: >><<log diff color_words diff added line_number:: 1>><<log diff color_words diff::: >><<log diff color_words diff removed token::a>><<log diff color_words diff added token::b>><<log diff color_words diff::>>
<<log diff color_words diff:: >><<log diff color_words diff added line_number:: 2>><<log diff color_words diff::: >><<log diff color_words diff added token::c>>
<<log::=== git ===>>
<<log diff git diff file_header::diff --git a/file1 b/file1>>
<<log diff git diff file_header::index 422c2b7ab3..de980441c3 100644>>
<<log diff git diff file_header::--- a/file1>>
<<log diff git diff file_header::+++ b/file1>>
<<log diff git diff hunk_header::@@ -1,2 +1,3 @@>>
<<log diff git diff context:: a>>
<<log diff git diff context:: b>>
<<log diff git diff added::+>><<log diff git diff added token::c>>
<<log diff git diff file_header::diff --git a/file2 b/file2>>
<<log diff git diff file_header::index 7898192261..9ddeb5c484 100644>>
<<log diff git diff file_header::--- a/file2>>
<<log diff git diff file_header::+++ b/file2>>
<<log diff git diff hunk_header::@@ -1,1 +1,2 @@>>
<<log diff git diff removed::->><<log diff git diff removed token::a>><<log diff git diff removed::>>
<<log diff git diff added::+>><<log diff git diff added token::b>><<log diff git diff added::>>
<<log diff git diff added::+>><<log diff git diff added token::c>>
<<log::=== stat ===>>
<<log diff stat diff::file1 | 1 >><<log diff stat diff added::+>><<log diff stat diff removed::>>
<<log diff stat diff::file2 | 3 >><<log diff stat diff added::++>><<log diff stat diff removed::->>
<<log diff stat diff stat-summary::2 files changed, 3 insertions(+), 1 deletion(-)>>
<<log::=== summary ===>>
<<log diff summary diff modified::M file1>>
<<log diff summary diff modified::M file2>>
"###);
// cwd != workspace root
let stdout = test_env.jj_cmd_success(
test_env.env_root(),