Skip to content

Commit b462386

Browse files
Unique-Usmangitster
authored andcommitted
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 <[email protected]> Signed-off-by: Usman Akinyemi <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 829971a commit b462386

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

t/t5701-git-serve.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,28 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
77

88
. ./test-lib.sh
99

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+
1113
test_oid_cache <<-EOF &&
1214
wrong_algo sha1:sha256
1315
wrong_algo sha256:sha1
1416
EOF
17+
1518
cat >expect.base <<-EOF &&
1619
version 2
17-
agent=git/$(git version | cut -d" " -f3)
20+
$(cat agent_capability)
1821
ls-refs=unborn
1922
fetch=shallow wait-for-done
2023
server-option
2124
object-format=$(test_oid algo)
2225
EOF
23-
cat >expect.trailer <<-EOF &&
26+
cat >expect.trailer <<-EOF
2427
0000
2528
EOF
29+
'
30+
31+
test_expect_success 'test capability advertisement' '
2632
cat expect.base expect.trailer >expect &&
2733
2834
GIT_TEST_SIDEBAND_ALL=0 test-tool serve-v2 \

0 commit comments

Comments
 (0)