Skip to content

Commit 4575ba6

Browse files
rscharfegitster
authored andcommitted
t0080: use here-doc test body
Improve the readability of the expected output by using a here-doc for the test body and replacing the unwieldy ${SQ} references with literal single quotes. Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d19b6cd commit 4575ba6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

t/t0080-unit-test-output.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ test_description='Test the output of the unit test framework'
55
TEST_PASSES_SANITIZE_LEAK=true
66
. ./test-lib.sh
77

8-
test_expect_success 'TAP output from unit tests' '
8+
test_expect_success 'TAP output from unit tests' - <<\EOT
99
cat >expect <<-EOF &&
1010
ok 1 - passing test
1111
ok 2 - passing test and assertion return 1
@@ -16,12 +16,12 @@ test_expect_success 'TAP output from unit tests' '
1616
ok 4 - failing test and assertion return 0
1717
not ok 5 - passing TEST_TODO() # TODO
1818
ok 6 - passing TEST_TODO() returns 1
19-
# todo check ${SQ}check(x)${SQ} succeeded at t/helper/test-example-tap.c:26
19+
# todo check 'check(x)' succeeded at t/helper/test-example-tap.c:26
2020
not ok 7 - failing TEST_TODO()
2121
ok 8 - failing TEST_TODO() returns 0
2222
# check "0" failed at t/helper/test-example-tap.c:31
2323
# skipping test - missing prerequisite
24-
# skipping check ${SQ}1${SQ} at t/helper/test-example-tap.c:33
24+
# skipping check '1' at t/helper/test-example-tap.c:33
2525
ok 9 - test_skip() # SKIP
2626
ok 10 - skipped test returns 1
2727
# skipping test - missing prerequisite
@@ -39,12 +39,12 @@ test_expect_success 'TAP output from unit tests' '
3939
# check "!strcmp("NULL", NULL)" failed at t/helper/test-example-tap.c:63
4040
# left: "NULL"
4141
# right: NULL
42-
# check "${SQ}a${SQ} == ${SQ}\n${SQ}" failed at t/helper/test-example-tap.c:64
43-
# left: ${SQ}a${SQ}
44-
# right: ${SQ}\012${SQ}
45-
# check "${SQ}\\\\${SQ} == ${SQ}\\${SQ}${SQ}" failed at t/helper/test-example-tap.c:65
46-
# left: ${SQ}\\\\${SQ}
47-
# right: ${SQ}\\${SQ}${SQ}
42+
# check "'a' == '\n'" failed at t/helper/test-example-tap.c:64
43+
# left: 'a'
44+
# right: '\012'
45+
# check "'\\\\' == '\\''" failed at t/helper/test-example-tap.c:65
46+
# left: '\\\\'
47+
# right: '\\''
4848
not ok 17 - messages from failing string and char comparison
4949
# BUG: test has no checks at t/helper/test-example-tap.c:92
5050
not ok 18 - test with no checks
@@ -54,6 +54,6 @@ test_expect_success 'TAP output from unit tests' '
5454
5555
! test-tool example-tap >actual &&
5656
test_cmp expect actual
57-
'
57+
EOT
5858

5959
test_done

0 commit comments

Comments
 (0)