tests: cosmetic changes in t/extra-sources.sh
[platform/upstream/automake.git] / t / automake-cmdline.tap
1 #! /bin/sh
2 # Copyright (C) 2004-2013 Free Software Foundation, Inc.
3 #
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)
7 # any later version.
8 #
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.
13 #
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/>.
16
17 # Test Automake's command-line options.
18
19 . test-init.sh
20
21 plan_ 17
22
23 # Usage: bad_cmdline DESCRIPTION REGEX-FOR-STDERR [ARGS-FOR-AUTOMAKE...]
24 do_check ()
25 {
26   test $# -ge 3 || fatal_ "do_check: invalid usage"
27   desc=$1; shift
28   regex=$1; shift
29   AUTOMAKE_fails -d "$desc (run)" -- "$@"
30   command_ok_ "$desc (stderr)" grep "$regex" stderr
31 }
32
33 do_check 'invalid long option' 'unrecognized option.*--voo' --voo
34
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
39 else
40   skip_row_ 2 -r "older perl with buggy Getopt::Long"
41 fi
42
43 do_check "empty argument" \
44          'empty argument' ''
45
46 do_check "missing argument for long option" \
47          'option.*-W.*requires an argument' -W
48
49 do_check "missing argument for short option" \
50          'option.*--warnings.*requires an argument' --warnings
51
52 do_check "'--help' as option argument" \
53          'unknown warning.*--help' --warnings --help
54
55 do_check "'--help' as option argument" \
56          'unknown warning.*--help' --warnings --help
57
58 do_check "ambiguous incomplete option" \
59          'unrecognized option.*--ver' --ver
60
61 command_ok_ "unambiguous incomplete long option" $AUTOMAKE --vers
62
63 :