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. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Nov 1, 2018 at 13:46 UTC 4b47a9a85ee43de37986721e5c5cb70f5652544b
1 file changed +8 -4
t/t6600-test-reach.sh
+8 -4
@@ -53,18 +53,22 @@ test_expect_success 'setup' '
53 git config core.commitGraph true
54 '
55
56 -test_three_modes () {
56 +run_three_modes () {
57 test_when_finished rm -rf .git/objects/info/commit-graph &&
58 - test-tool reach $1 <input >actual &&
58 + "$@" <input >actual &&
59 test_cmp expect actual &&
60 cp commit-graph-full .git/objects/info/commit-graph &&
61 - test-tool reach $1 <input >actual &&
61 + "$@" <input >actual &&
62 test_cmp expect actual &&
63 cp commit-graph-half .git/objects/info/commit-graph &&
64 - test-tool reach $1 <input >actual &&
64 + "$@" <input >actual &&
65 test_cmp expect actual
66 }
67
68 +test_three_modes () {
69 + run_three_modes test-tool reach "$@"
70 +}
71 +
72 test_expect_success 'ref_newer:miss' '
73 cat >input <<-\EOF &&
74 A:commit-5-7