3 # Copyright (C) 2006-2024 Free Software Foundation, Inc.
4 # This file is part of the GNUlib Library.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>. */
19 .
"${srcdir=.}/init.sh"; path_prepend_ .
26 # If argp was compiled without base_name, it will display full program name.
27 # If run on mingw, it will display the program name with a .exe suffix.
29 s,: [^ ]*/test-argp,: test-argp,
30 s,: test-argp\.exe,: test-argp,
31 }' | LC_ALL
=C
tr -d '\r' > out
38 Usage: test-argp [-tvCSOlp?V] [-f FILE] [-r FILE] [-o[ARG]] [--test]
39 [--file=FILE] [--input=FILE] [--read=FILE] [--verbose] [--cantiga]
40 [--sonet] [--option] [--optional[=ARG]] [--many] [--one] [--two]
41 [--limerick] [--poem] [--help] [--usage] [--version] ARGS...
44 ${CHECKER} test-argp
${EXEEXT} --usage | func_compare || ERR
=1
47 # Test working usage-indent format
50 Usage: test-argp [-tvCSOlp?V] [-f FILE] [-r FILE] [-o[ARG]] [--test]
51 [--file=FILE] [--input=FILE] [--read=FILE] [--verbose] [--cantiga] [--sonet]
52 [--option] [--optional[=ARG]] [--many] [--one] [--two] [--limerick] [--poem]
53 [--help] [--usage] [--version] ARGS...
56 ARGP_HELP_FMT
='usage-indent=0' ${CHECKER} test-argp
${EXEEXT} --usage | func_compare || ERR
=1
61 Usage: test-argp [OPTION...] ARGS...
68 -f, -r, --file=FILE, --input=FILE, --read=FILE
69 Option with a mandatory argument
70 -v, --verbose Simple option without arguments
73 -C, --cantiga create a cantiga
74 -S, --sonet create a sonet
77 -O, --option An option
79 -o, --optional[=ARG] Option with an optional argument. ARG is one of
87 -l, --limerick create a limerick
88 -p, --poem create a poem
90 -?, --help give this help list
91 --usage give a short usage message
92 -V, --version print program version
94 Mandatory or optional arguments to long options are also mandatory or optional
95 for any corresponding short options.
100 # Compare --help output, but filter out any bug-reporting email address.
101 ${CHECKER} test-argp
${EXEEXT} --help \
102 |
sed 's/^\(Report bugs to \)<[^>]*>.$/\1<>./' | func_compare || ERR
=1
105 # Test ambiguous option handling
107 ${CHECKER} test-argp
${EXEEXT} --optio 2>/dev
/null
&& ERR
=1
111 ${CHECKER} test-argp
${EXEEXT} || ERR
=1