test-reach: add run_three_modes method
authorDerrick Stolee <stolee@gmail.com>
Thu, 1 Nov 2018 13:46:18 +0000 (13:46 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 Nov 2018 03:14:22 +0000 (12:14 +0900)
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.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6600-test-reach.sh
index d139a00d1dd2bb3a178e65d7cbbce39faf4eff42..9d65b8b946cc3c5afd21f3b7f0f0030810171bee 100755 (executable)
@@ -53,18 +53,22 @@ test_expect_success 'setup' '
        git config core.commitGraph true
 '
 
-test_three_modes () {
+run_three_modes () {
        test_when_finished rm -rf .git/objects/info/commit-graph &&
-       test-tool reach $1 <input >actual &&
+       "$@" <input >actual &&
        test_cmp expect actual &&
        cp commit-graph-full .git/objects/info/commit-graph &&
-       test-tool reach $1 <input >actual &&
+       "$@" <input >actual &&
        test_cmp expect actual &&
        cp commit-graph-half .git/objects/info/commit-graph &&
-       test-tool reach $1 <input >actual &&
+       "$@" <input >actual &&
        test_cmp expect actual
 }
 
+test_three_modes () {
+       run_three_modes test-tool reach "$@"
+}
+
 test_expect_success 'ref_newer:miss' '
        cat >input <<-\EOF &&
        A:commit-5-7