2 # Copyright (C) 2011-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 'py-compile --help', 'py-compile --version', and that 'py-compile'
18 # correctly complains on wrong usage.
22 cp "$am_scriptdir/py-compile" . \
23 || fatal_
"failed to fetch auxiliary script py-compile"
27 .
/py-compile
--help >stdout
2>stderr \
28 ||
{ cat stdout
; cat stderr
>&2; exit 1; }
30 test -s stderr
&& { cat stderr
>&2; exit 1; }
31 grep '^Usage: py-compile .' stdout
32 $FGREP ' [--basedir DIR]' stdout
33 $FGREP ' [--destdir DIR]' stdout
37 .
/py-compile
--version >stdout
2>stderr \
38 ||
{ cat stdout
; cat stderr
>&2; exit 1; }
40 test -s stderr
&& { cat stderr
>&2; exit 1; }
41 year
='20[0-9][0-9]' # Hopefully automake will be obsolete in 80 years ;-)
42 month
='(0[0-9]|1[012])'
43 day
='([012][0-9]|3[01])'
44 hour
='([01][0-9]|2[0123])'
45 LC_ALL
=C
$EGREP "^py-compile $year-$month-$day\.$hour" stdout
46 test $
(wc -l <stdout
) -eq 1
50 for opt
in -b -d --foo; do
51 .
/py-compile
$opt 2>stderr
&& { cat stderr
>&2; exit 1; }
53 grep "^py-compile: unrecognized option '$opt'" stderr
54 grep "^Try 'py-compile --help' for more information" stderr
57 # Missing option argument.
59 for opt
in --basedir --destdir; do
60 .
/py-compile
$opt 2>stderr
&& { cat stderr
>&2; exit 1; }
62 grep "^py-compile: option '$opt' requires an argument" stderr
63 grep "^Try 'py-compile --help' for more information" stderr
68 for args
in '' '--basedir dir' '--destdir dir'; do
69 .
/py-compile
$args 2>stderr
&& { cat stderr
>&2; exit 1; }
71 grep '^py-compile: no files given' stderr
72 grep "^Try 'py-compile --help' for more information" stderr