t5701: add setup test to remove side-effect dependency
Currently, the "test capability advertisement" test creates some files with expected content which are used by other tests below it. To remove that side-effect from this test, let's split up part of it into a "setup"-type test which creates the files with expected content which gets reused by multiple tests. This will be useful in a following commit. Mentored-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Usman Akinyemi committed
Feb 15, 2025 at 21:20 UTC
15ff206863a77e3396f5a1e1ed4910b7b70c9f8d
1 file changed
+9
-3
t/t5701-git-serve.sh
+9
-3
@@ -7,22 +7,28 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
. ./test-lib.sh
9
10
-test_expect_success 'test capability advertisement' '
10
+test_expect_success 'setup to generate files with expected content' '
11
+ printf "agent=git/%s\n" "$(git version | cut -d" " -f3)" >agent_capability &&
12
+
13
test_oid_cache <<-EOF &&
14
wrong_algo sha1:sha256
15
wrong_algo sha256:sha1
16
EOF
17
+
18
cat >expect.base <<-EOF &&
19
version 2
17
- agent=git/$(git version | cut -d" " -f3)
20
+ $(cat agent_capability)
21
ls-refs=unborn
22
fetch=shallow wait-for-done
23
server-option
24
object-format=$(test_oid algo)
25
EOF
23
- cat >expect.trailer <<-EOF &&
26
+ cat >expect.trailer <<-EOF
27
0000
28
EOF
29
+'
30
+
31
+test_expect_success 'test capability advertisement' '
32
cat expect.base expect.trailer >expect &&
33
34
GIT_TEST_SIDEBAND_ALL=0 test-tool serve-v2 \