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 # Sanity check for the automake testsuite.
18 # Check the 'seq_' subroutine.
24 unset stderr_fileno_ || :
28 desc=$1 args=$2 exp=$3
29 st=0; got=`seq_ $args` || st=$?
30 command_ok_ "$desc [exit status = 0]" test $st -eq 0
31 command_ok_ "$desc [output]" test x"$exp" = x"$got"
34 check_work 'one-argument form' '5' "\
41 check_work 'two-arguments form' '7 11' "\
48 check_work 'three-arguments form (1)' '120 5 135' "\
54 check_work 'three-arguments form (1)' '13 4 23' "\
61 desc=$1 args=$2 err=$3
62 (seq_ $args) >output || st=$?
63 # Protect content emitted on stdout/stderr, to avoid sending to the
64 # TAP driver possible "Bail out!" directives generated by 'seq_'.
65 # Use 'grep -c' below for the same reason.
67 command_ok_ "$desc [exit status = 99]" test $st -eq 99
68 command_ok_ "$desc [error message]" grep -c "seq_: $err" output
71 check_err 'no argument is an error' '' 'missing argument'
72 check_err 'four arguments is an error' '1 1 2 1' 'too many arguments'
73 check_err 'six arguments is an error' '1 1 1 1 1 1' 'too many arguments'