2 # Copyright (C) 2004-2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Test Automake's command-line options.
23 # Usage: bad_cmdline DESCRIPTION REGEX-FOR-STDERR [ARGS-FOR-AUTOMAKE...]
26 test $# -ge 3 || fatal_ "do_check: invalid usage"
29 AUTOMAKE_fails -d "$desc (run)" -- "$@"
30 command_ok_ "$desc (stderr)" grep "$regex" stderr
33 do_check 'invalid long option' 'unrecognized option.*--voo' --voo
35 # Older perl has a buggy Getopt::Long which makes this fail.
36 if $PERL -e 'require 5.8.2;'; then
37 do_check "list of options terminated by '--'" \
38 'input file.*--voo' -- --voo
40 skip_row_ 2 -r "older perl with buggy Getopt::Long"
43 do_check "empty argument" \
46 do_check "missing argument for long option" \
47 'option.*-W.*requires an argument' -W
49 do_check "missing argument for short option" \
50 'option.*--warnings.*requires an argument' --warnings
52 do_check "'--help' as option argument" \
53 'unknown warning.*--help' --warnings --help
55 do_check "'--help' as option argument" \
56 'unknown warning.*--help' --warnings --help
58 do_check "ambiguous incomplete option" \
59 'unrecognized option.*--ver' --ver
61 command_ok_ "unambiguous incomplete long option" $AUTOMAKE --vers