1 dnl Copyright © 2015, 2021-2023 Nick Bowler
3 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 dnl This is free software: you are free to do what the fuck you want to.
5 dnl There is NO WARRANTY, to the extent permitted by law.
7 m4_divert_push([PREPARE_TESTS])dnl
9 "$builddir/t/$1" > "$1.tap"
15 m4_divert_pop([PREPARE_TESTS])
17 m4_define([TEST_TAP], [AT_CHECK([test_run_tap "$1"], [0], [ignore])])
18 m4_define([TEST_TAP_SIMPLE], [dnl
25 AT_BANNER([Binary packing functions])
27 TEST_TAP_SIMPLE([signed unpacking], [packtests], [], [pack])
28 TEST_TAP_SIMPLE([unsigned unpacking], [packtestu], [], [pack])
29 TEST_TAP_SIMPLE([64-bit signed unpacking], [packtests64], [], [pack])
30 TEST_TAP_SIMPLE([64-bit unsigned unpacking], [packtestu64], [], [pack])
32 AT_BANNER([Help formatting functions])
34 AT_SETUP([help_print_desc])
37 AT_SKIP_IF([test ! -x "$builddir/t/helpdesc"])
40 [[this is the first line
41 this is the second line
42 this is the third line
46 sed -e '5,$s/^/ /' -e '6,$s/^/ /' \
48 -e '13s/^ *//' -e '14,$s/^/ /' \
49 test.txt test.txt test.txt test.txt >expout
51 AT_CHECK(["$builddir/t/helpdesc" 0 0 10 5 30 20 40 40 <test.txt],
56 AT_SETUP([help_print_desc (empty description)])
59 AT_SKIP_IF([test ! -x "$builddir/t/helpdesc"])
61 AT_CHECK(["$builddir/t/helpdesc" 0 0 0 20 </dev/null])
62 AT_CHECK(["$builddir/t/helpdesc" 1 20 </dev/null], [0], [
67 AT_SETUP([help_print_optstring])
70 AT_SKIP_IF([test ! -x "$builddir/t/helpopt"])
72 AT_CHECK([m4_join([ ],
73 ["$builddir/t/helpopt"],
78 [--quux '@<:@ARG@:>@'],
79 [--quux -q '@<:@ARG@:>@'],
80 [--hello-this-is-a-very-long-option 20],
81 [--hello-this-is-a-very-long-option 50],
83 [--flagged -f \&])], [0],
90 --hello-this-is-a-very-long-option
92 --hello-this-is-a-very-long-option 36
99 AT_SETUP([help_print_optstring (getopt_long_only)])
102 AT_SKIP_IF([test ! -x "$builddir/t/helpopt2"])
104 AT_CHECK([m4_join([ ],
105 ["$builddir/t/helpopt2"],
110 [--quux '@<:@ARG@:>@'],
111 [--quux -q '@<:@ARG@:>@'],
112 [--hello-this-is-a-very-long-option 20],
113 [--hello-this-is-a-very-long-option 50],
115 [--flagged -f \&])], [0],
122 -hello-this-is-a-very-long-option
124 -hello-this-is-a-very-long-option 35