Skip to content

Commit 9cf3f14

Browse files
trastgitster
authored andcommitted
t0000: quote TAP snippets in test code
t0000 contains two snippets of actual test output. This causes problems when passing -v to the test[*]: the test infrastructure echoes the tests before running them, and the TAP parser then sees this test output and concludes that two tests failed and that the TAP output was badly formatted. Guard against this by quoting the output in the source. [*] either by running 'make smoke' with GIT_TEST_OPTS=-v, or with prove ./t0000-basic.sh :: -v Signed-off-by: Thomas Rast <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d2f15e2 commit 9cf3f14

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

t/t0000-basic.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ EOF
8080
chmod +x passing-todo.sh &&
8181
./passing-todo.sh >out 2>err &&
8282
! test -s err &&
83-
cat >expect <<EOF &&
84-
ok 1 - pretend we have fixed a known breakage # TODO known breakage
85-
# fixed 1 known breakage(s)
86-
# passed all 1 test(s)
87-
1..1
83+
sed -e 's/^> //' >expect <<EOF &&
84+
> ok 1 - pretend we have fixed a known breakage # TODO known breakage
85+
> # fixed 1 known breakage(s)
86+
> # passed all 1 test(s)
87+
> 1..1
8888
EOF
8989
test_cmp expect out)
9090
"
@@ -164,19 +164,19 @@ EOF
164164
test_must_fail ./failing-cleanup.sh >out 2>err &&
165165
! test -s err &&
166166
! test -f \"trash directory.failing-cleanup/clean-after-failure\" &&
167-
sed -e 's/Z$//' >expect <<\EOF &&
168-
not ok - 1 tests clean up even after a failure
169-
# Z
170-
# touch clean-after-failure &&
171-
# test_when_finished rm clean-after-failure &&
172-
# (exit 1)
173-
# Z
174-
not ok - 2 failure to clean up causes the test to fail
175-
# Z
176-
# test_when_finished \"(exit 2)\"
177-
# Z
178-
# failed 2 among 2 test(s)
179-
1..2
167+
sed -e 's/Z$//' -e 's/^> //' >expect <<\EOF &&
168+
> not ok - 1 tests clean up even after a failure
169+
> # Z
170+
> # touch clean-after-failure &&
171+
> # test_when_finished rm clean-after-failure &&
172+
> # (exit 1)
173+
> # Z
174+
> not ok - 2 failure to clean up causes the test to fail
175+
> # Z
176+
> # test_when_finished \"(exit 2)\"
177+
> # Z
178+
> # failed 2 among 2 test(s)
179+
> 1..2
180180
EOF
181181
test_cmp expect out)
182182
"

0 commit comments

Comments
 (0)