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 <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Jul 30, 2024 at 16:05 UTC
4575ba6a7c579ab5ac46d929c7c5de20013938cf
1 file changed
+10
-10
t/t0080-unit-test-output.sh
+10
-10
@@ -5,7 +5,7 @@ test_description='Test the output of the unit test framework'
5
TEST_PASSES_SANITIZE_LEAK=true
6
. ./test-lib.sh
7
8
-test_expect_success 'TAP output from unit tests' '
8
+test_expect_success 'TAP output from unit tests' - <<\EOT
9
cat >expect <<-EOF &&
10
ok 1 - passing test
11
ok 2 - passing test and assertion return 1
@@ -16,12 +16,12 @@ test_expect_success 'TAP output from unit tests' '
16
ok 4 - failing test and assertion return 0
17
not ok 5 - passing TEST_TODO() # TODO
18
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
20
not ok 7 - failing TEST_TODO()
21
ok 8 - failing TEST_TODO() returns 0
22
# check "0" failed at t/helper/test-example-tap.c:31
23
# 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
25
ok 9 - test_skip() # SKIP
26
ok 10 - skipped test returns 1
27
# skipping test - missing prerequisite
@@ -39,12 +39,12 @@ test_expect_success 'TAP output from unit tests' '
39
# check "!strcmp("NULL", NULL)" failed at t/helper/test-example-tap.c:63
40
# left: "NULL"
41
# 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: '\\''
48
not ok 17 - messages from failing string and char comparison
49
# BUG: test has no checks at t/helper/test-example-tap.c:92
50
not ok 18 - test with no checks
@@ -54,6 +54,6 @@ test_expect_success 'TAP output from unit tests' '
54
55
! test-tool example-tap >actual &&
56
test_cmp expect actual
57
-'
57
+EOT
58
59
test_done