Skip to content

Commit fbcf99e

Browse files
peffgitster
authored andcommitted
diff-highlight: test graphs with --color
Our tests send git's output directly to files or pipes, so there will never be any color. Let's do at least one --color test to make sure that we can handle this case (which we currently can, but will be an easy thing to mess up when we touch the graph code in a future patch). We'll just cover the --graph case, since this is much more complex than the earlier cases (i.e., if it manages to highlight, then the non-graph case definitely would). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7ce2f4c commit fbcf99e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

contrib/diff-highlight/t/t9400-diff-highlight.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,15 @@ test_expect_success 'diff-highlight works with the --graph option' '
264264
test_cmp graph.exp graph.act
265265
'
266266

267+
# Just reuse the previous graph test, but with --color. Our trimming
268+
# doesn't know about color, so just sanity check that something got
269+
# highlighted.
270+
test_expect_success 'diff-highlight works with color graph' '
271+
git log --branches -p --date-order --graph --color |
272+
"$DIFF_HIGHLIGHT" | trim_graph | left_trim >graph &&
273+
grep "\[7m" graph
274+
'
275+
267276
# Most combined diffs won't meet diff-highlight's line-number filter. So we
268277
# create one here where one side drops a line and the other modifies it. That
269278
# should result in a diff like:

0 commit comments

Comments
 (0)