Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='Test the output of the unit test framework' |
| 4 | |
Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 5 | . ./test-lib.sh |
| 6 | |
René Scharfe | 4575ba6 | 2024-07-30 16:05:58 +0200 | [diff] [blame] | 7 | test_expect_success 'TAP output from unit tests' - <<\EOT |
Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 8 | cat >expect <<-EOF && |
René Scharfe | 1f452d6 | 2024-07-30 16:07:00 +0200 | [diff] [blame] | 9 | # BUG: check outside of test at t/helper/test-example-tap.c:75 |
Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 10 | ok 1 - passing test |
| 11 | ok 2 - passing test and assertion return 1 |
René Scharfe | 1f452d6 | 2024-07-30 16:07:00 +0200 | [diff] [blame] | 12 | # check "1 == 2" failed at t/helper/test-example-tap.c:79 |
Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 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 |
René Scharfe | 4575ba6 | 2024-07-30 16:05:58 +0200 | [diff] [blame] | 19 | # todo check 'check(x)' succeeded at t/helper/test-example-tap.c:26 |
Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 20 | not ok 7 - failing TEST_TODO() |
| 21 | ok 8 - failing TEST_TODO() returns 0 |
Josh Steadmon | 80bb227 | 2024-05-06 12:57:31 -0700 | [diff] [blame] | 22 | # check "0" failed at t/helper/test-example-tap.c:31 |
Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 23 | # skipping test - missing prerequisite |
René Scharfe | 4575ba6 | 2024-07-30 16:05:58 +0200 | [diff] [blame] | 24 | # skipping check '1' at t/helper/test-example-tap.c:33 |
Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 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 |
Josh Steadmon | 80bb227 | 2024-05-06 12:57:31 -0700 | [diff] [blame] | 30 | # check "0" failed at t/helper/test-example-tap.c:49 |
Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 31 | not ok 13 - TEST_TODO() after failing check |
| 32 | ok 14 - TEST_TODO() after failing check returns 0 |
Josh Steadmon | 80bb227 | 2024-05-06 12:57:31 -0700 | [diff] [blame] | 33 | # check "0" failed at t/helper/test-example-tap.c:57 |
Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 34 | not ok 15 - failing check after TEST_TODO() |
| 35 | ok 16 - failing check after TEST_TODO() returns 0 |
Josh Steadmon | 80bb227 | 2024-05-06 12:57:31 -0700 | [diff] [blame] | 36 | # check "!strcmp("\thello\\\\", "there\"\n")" failed at t/helper/test-example-tap.c:62 |
Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 37 | # left: "\011hello\\\\" |
| 38 | # right: "there\"\012" |
Josh Steadmon | 80bb227 | 2024-05-06 12:57:31 -0700 | [diff] [blame] | 39 | # check "!strcmp("NULL", NULL)" failed at t/helper/test-example-tap.c:63 |
Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 40 | # left: "NULL" |
| 41 | # right: NULL |
René Scharfe | 4575ba6 | 2024-07-30 16:05:58 +0200 | [diff] [blame] | 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: '\\'' |
Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 48 | not ok 17 - messages from failing string and char comparison |
René Scharfe | 1f452d6 | 2024-07-30 16:07:00 +0200 | [diff] [blame] | 49 | # BUG: test has no checks at t/helper/test-example-tap.c:94 |
Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 50 | not ok 18 - test with no checks |
| 51 | ok 19 - test with no checks returns 0 |
René Scharfe | 96c6304 | 2024-07-30 16:08:19 +0200 | [diff] [blame] | 52 | ok 20 - if_test passing test |
| 53 | # check "1 == 2" failed at t/helper/test-example-tap.c:100 |
| 54 | # left: 1 |
| 55 | # right: 2 |
| 56 | not ok 21 - if_test failing test |
| 57 | not ok 22 - if_test passing TEST_TODO() # TODO |
| 58 | # todo check 'check(1)' succeeded at t/helper/test-example-tap.c:104 |
| 59 | not ok 23 - if_test failing TEST_TODO() |
| 60 | # check "0" failed at t/helper/test-example-tap.c:106 |
| 61 | # skipping test - missing prerequisite |
| 62 | # skipping check '1' at t/helper/test-example-tap.c:108 |
| 63 | ok 24 - if_test test_skip() # SKIP |
| 64 | # skipping test - missing prerequisite |
| 65 | ok 25 - if_test test_skip() inside TEST_TODO() # SKIP |
| 66 | # check "0" failed at t/helper/test-example-tap.c:113 |
| 67 | not ok 26 - if_test TEST_TODO() after failing check |
| 68 | # check "0" failed at t/helper/test-example-tap.c:119 |
| 69 | not ok 27 - if_test failing check after TEST_TODO() |
| 70 | # check "!strcmp("\thello\\\\", "there\"\n")" failed at t/helper/test-example-tap.c:122 |
| 71 | # left: "\011hello\\\\" |
| 72 | # right: "there\"\012" |
| 73 | # check "!strcmp("NULL", NULL)" failed at t/helper/test-example-tap.c:123 |
| 74 | # left: "NULL" |
| 75 | # right: NULL |
| 76 | # check "'a' == '\n'" failed at t/helper/test-example-tap.c:124 |
| 77 | # left: 'a' |
| 78 | # right: '\012' |
| 79 | # check "'\\\\' == '\\''" failed at t/helper/test-example-tap.c:125 |
| 80 | # left: '\\\\' |
| 81 | # right: '\\'' |
| 82 | not ok 28 - if_test messages from failing string and char comparison |
| 83 | # BUG: test has no checks at t/helper/test-example-tap.c:127 |
| 84 | not ok 29 - if_test test with no checks |
| 85 | 1..29 |
Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 86 | EOF |
| 87 | |
Josh Steadmon | 80bb227 | 2024-05-06 12:57:31 -0700 | [diff] [blame] | 88 | ! test-tool example-tap >actual && |
Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 89 | test_cmp expect actual |
René Scharfe | 4575ba6 | 2024-07-30 16:05:58 +0200 | [diff] [blame] | 90 | EOT |
Phillip Wood | e137fe3 | 2023-11-09 10:50:43 -0800 | [diff] [blame] | 91 | |
| 92 | test_done |