Start the 2.46 cycle
[git/gitster.git] / t / t0080-unit-test-output.sh
blob6657c114a36c7ea650a974a2f556b7f87435c251
1 #!/bin/sh
3 test_description='Test the output of the unit test framework'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'TAP output from unit tests' '
9 cat >expect <<-EOF &&
10 ok 1 - passing test
11 ok 2 - passing test and assertion return 1
12 # check "1 == 2" failed at t/unit-tests/t-basic.c:76
13 # left: 1
14 # right: 2
15 not ok 3 - failing test
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/unit-tests/t-basic.c:25
20 not ok 7 - failing TEST_TODO()
21 ok 8 - failing TEST_TODO() returns 0
22 # check "0" failed at t/unit-tests/t-basic.c:30
23 # skipping test - missing prerequisite
24 # skipping check ${SQ}1${SQ} at t/unit-tests/t-basic.c:32
25 ok 9 - test_skip() # SKIP
26 ok 10 - skipped test returns 1
27 # skipping test - missing prerequisite
28 ok 11 - test_skip() inside TEST_TODO() # SKIP
29 ok 12 - test_skip() inside TEST_TODO() returns 1
30 # check "0" failed at t/unit-tests/t-basic.c:48
31 not ok 13 - TEST_TODO() after failing check
32 ok 14 - TEST_TODO() after failing check returns 0
33 # check "0" failed at t/unit-tests/t-basic.c:56
34 not ok 15 - failing check after TEST_TODO()
35 ok 16 - failing check after TEST_TODO() returns 0
36 # check "!strcmp("\thello\\\\", "there\"\n")" failed at t/unit-tests/t-basic.c:61
37 # left: "\011hello\\\\"
38 # right: "there\"\012"
39 # check "!strcmp("NULL", NULL)" failed at t/unit-tests/t-basic.c:62
40 # left: "NULL"
41 # right: NULL
42 # check "${SQ}a${SQ} == ${SQ}\n${SQ}" failed at t/unit-tests/t-basic.c:63
43 # left: ${SQ}a${SQ}
44 # right: ${SQ}\012${SQ}
45 # check "${SQ}\\\\${SQ} == ${SQ}\\${SQ}${SQ}" failed at t/unit-tests/t-basic.c:64
46 # left: ${SQ}\\\\${SQ}
47 # right: ${SQ}\\${SQ}${SQ}
48 not ok 17 - messages from failing string and char comparison
49 # BUG: test has no checks at t/unit-tests/t-basic.c:91
50 not ok 18 - test with no checks
51 ok 19 - test with no checks returns 0
52 1..19
53 EOF
55 ! "$GIT_BUILD_DIR"/t/unit-tests/bin/t-basic >actual &&
56 test_cmp expect actual
59 test_done