Skip to content

Commit 9628396

Browse files
committed
test-reach: add run_three_modes method
The 'test_three_modes' method assumes we are using the 'test-tool reach' command for our test. However, we may want to use the data shape of our commit graph and the three modes (no commit-graph, full commit-graph, partial commit-graph) for other git commands. Split test_three_modes to be a simple translation on a more general run_three_modes method that executes the given command and tests the actual output to the expected output. While inspecting this code, I realized that the final test for 'commit_contains --tag' is silently dropping the '--tag' argument. It should be quoted to include both. Signed-off-by: Derrick Stolee <[email protected]>
1 parent 5e55669 commit 9628396

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

t/t6600-test-reach.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,22 @@ test_expect_success 'setup' '
5353
git config core.commitGraph true
5454
'
5555

56-
test_three_modes () {
56+
run_three_modes () {
5757
test_when_finished rm -rf .git/objects/info/commit-graph &&
58-
test-tool reach $1 <input >actual &&
58+
$1 <input >actual &&
5959
test_cmp expect actual &&
6060
cp commit-graph-full .git/objects/info/commit-graph &&
61-
test-tool reach $1 <input >actual &&
61+
$1 <input >actual &&
6262
test_cmp expect actual &&
6363
cp commit-graph-half .git/objects/info/commit-graph &&
64-
test-tool reach $1 <input >actual &&
64+
$1 <input >actual &&
6565
test_cmp expect actual
6666
}
6767

68+
test_three_modes () {
69+
run_three_modes "test-tool reach $1"
70+
}
71+
6872
test_expect_success 'ref_newer:miss' '
6973
cat >input <<-\EOF &&
7074
A:commit-5-7
@@ -219,7 +223,7 @@ test_expect_success 'commit_contains:hit' '
219223
EOF
220224
echo "commit_contains(_,A,X,_):1" >expect &&
221225
test_three_modes commit_contains &&
222-
test_three_modes commit_contains --tag
226+
test_three_modes "commit_contains --tag"
223227
'
224228

225229
test_expect_success 'commit_contains:miss' '

0 commit comments

Comments
 (0)