Skip to content

Commit 63be8c8

Browse files
Denton-Lgitster
authored andcommitted
t4214: generate expect in their own test cases
Before, the expect files of the test case were being generated in the setup method. However, it would make more sense to generate these files within the test cases that actually use them so that it's obvious to future readers where the expected values are coming from. Move the generation of the expect files in their own respective test cases. While we're at it, we want to establish a pattern in this test suite that, firstly, a non-colored test case is given then, immediately after, the colored version is given. Switch test cases "log --graph with tricky octopus merge, no color" and "log --graph with tricky octopus merge with colors" so that the "no color" version appears first. This patch is best viewed with `--color-moved`. Signed-off-by: Denton Liu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a7a5590 commit 63be8c8

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

t/t4214-log-graph-octopus.sh

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ test_description='git log --graph of skewed left octopus merge.'
55
. ./test-lib.sh
66

77
test_expect_success 'set up merge history' '
8+
test_commit initial &&
9+
for i in 1 2 3 4 ; do
10+
git checkout master -b $i || return $?
11+
# Make tag name different from branch name, to avoid
12+
# ambiguity error when calling checkout.
13+
test_commit $i $i $i tag$i || return $?
14+
done &&
15+
git checkout 1 -b merge &&
16+
test_merge octopus-merge 1 2 3 4 &&
17+
git checkout 1 -b L &&
18+
test_commit left
19+
'
20+
21+
test_expect_success 'log --graph with tricky octopus merge, no color' '
822
cat >expect.uncolored <<-\EOF &&
923
* left
1024
| *---. octopus-merge
@@ -19,6 +33,13 @@ test_expect_success 'set up merge history' '
1933
|/
2034
* initial
2135
EOF
36+
git log --color=never --graph --date-order --pretty=tformat:%s --all >actual.raw &&
37+
sed "s/ *\$//" actual.raw >actual &&
38+
test_cmp expect.uncolored actual
39+
'
40+
41+
test_expect_success 'log --graph with tricky octopus merge with colors' '
42+
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
2243
cat >expect.colors <<-\EOF &&
2344
* left
2445
<RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
@@ -33,32 +54,11 @@ test_expect_success 'set up merge history' '
3354
<MAGENTA>|<RESET><MAGENTA>/<RESET>
3455
* initial
3556
EOF
36-
test_commit initial &&
37-
for i in 1 2 3 4 ; do
38-
git checkout master -b $i || return $?
39-
# Make tag name different from branch name, to avoid
40-
# ambiguity error when calling checkout.
41-
test_commit $i $i $i tag$i || return $?
42-
done &&
43-
git checkout 1 -b merge &&
44-
test_merge octopus-merge 1 2 3 4 &&
45-
git checkout 1 -b L &&
46-
test_commit left
47-
'
48-
49-
test_expect_success 'log --graph with tricky octopus merge with colors' '
50-
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
5157
git log --color=always --graph --date-order --pretty=tformat:%s --all >actual.colors.raw &&
5258
test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
5359
test_cmp expect.colors actual.colors
5460
'
5561

56-
test_expect_success 'log --graph with tricky octopus merge, no color' '
57-
git log --color=never --graph --date-order --pretty=tformat:%s --all >actual.raw &&
58-
sed "s/ *\$//" actual.raw >actual &&
59-
test_cmp expect.uncolored actual
60-
'
61-
6262
# Repeat the previous two tests with "normal" octopus merge (i.e.,
6363
# without the first parent skewing to the "left" branch column).
6464

0 commit comments

Comments
 (0)