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 AT_BANNER([Binary packing functions])
9 TEST_TAP_SIMPLE([signed unpacking], [packtests], [], [pack])
10 TEST_TAP_SIMPLE([unsigned unpacking], [packtestu], [], [pack])
11 TEST_TAP_SIMPLE([64-bit signed unpacking], [packtests64], [], [pack])
12 TEST_TAP_SIMPLE([64-bit unsigned unpacking], [packtestu64], [], [pack])
14 AT_BANNER([Help formatting functions])
16 AT_SETUP([help_print_desc])
19 AT_SKIP_IF([test ! -x "$builddir/t/helpdesc"])
22 [[this is the first line
23 this is the second line
24 this is the third line
28 sed -e '5,$s/^/ /' -e '6,$s/^/ /' \
30 -e '13s/^ *//' -e '14,$s/^/ /' \
31 test.txt test.txt test.txt test.txt >expout
33 AT_CHECK(["$builddir/t/helpdesc" 0 0 10 5 30 20 40 40 <test.txt],
36 AT_CHECK([AS_ECHO_N(["no trailing newline"]) |
37 "$builddir/t/helpdesc" 0 0], [0],
43 AT_SETUP([help_print_desc (empty description)])
46 AT_SKIP_IF([test ! -x "$builddir/t/helpdesc"])
48 AT_CHECK(["$builddir/t/helpdesc" 0 0 0 20 </dev/null], [0], [
51 AT_CHECK(["$builddir/t/helpdesc" 1 20 </dev/null], [0], [
56 AT_SETUP([help_print_optstring])
59 AT_SKIP_IF([test ! -x "$builddir/t/helpopt"])
61 AT_CHECK([m4_join([ ],
62 ["$builddir/t/helpopt"],
67 [--quux '@<:@ARG@:>@'],
68 [--quux -q '@<:@ARG@:>@'],
69 [--hello-this-is-a-very-long-option 20],
70 [--hello-this-is-a-very-long-option 50],
72 [--flagged -f \&])], [0],
79 --hello-this-is-a-very-long-option
81 --hello-this-is-a-very-long-option 36
88 AT_SETUP([help_print_optstring (getopt_long_only)])
91 AT_SKIP_IF([test ! -x "$builddir/t/helpopt2"])
93 AT_CHECK([m4_join([ ],
94 ["$builddir/t/helpopt2"],
99 [--quux '@<:@ARG@:>@'],
100 [--quux -q '@<:@ARG@:>@'],
101 [--hello-this-is-a-very-long-option 20],
102 [--hello-this-is-a-very-long-option 50],
104 [--flagged -f \&])], [0],
111 -hello-this-is-a-very-long-option
113 -hello-this-is-a-very-long-option 35
120 AT_SETUP([help_print_optstring (NLS fullwidth/halfwidth)])
121 AT_KEYWORDS([help nls])
123 AT_SKIP_IF([test ! -x "$builddir/t/helpopt3"])
124 TEST_UTF8_LOCALE([locale_utf8])
126 # Avoid some deficient shell parsers barfing on UTF-8 sequences by
127 # generating them this way using octal escapes.
128 $AWK -f - >expout <<'EOF'
130 zenkaku = "--\345\205\250\350\247\222";
131 hankaku = "--\357\276\212\357\276\235\357\275\266\357\275\270"
133 print zenkaku, hankaku >"args"
135 print " " zenkaku "\t" "8"
136 print " " hankaku "\t" "8"
140 AT_CHECK([LC_ALL=$locale_utf8 xargs "$builddir/t/helpopt3" <args],
145 AT_BANNER([Miscellaneous functions])
147 TEST_TAP_SIMPLE([copyright_symbol], [copysym], [], [])