Hash :
f37035c3
Author :
Date :
2011-07-16T10:55:05
test defs: new subroutine 'seq_', simulating GNU seq(1) * tests/defs (seq_): New subroutine. * tests/instmany.test: Use it. * tests/instmany-mans.test: Likewise. * tests/instmany-python.test: Likewise. * tests/self-check-seq.test: New self test. * tests/Makefile.am (TESTS): Update.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
#! /bin/sh
# Copyright (C) 2011 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Sanity check for the automake testsuite.
# Check the `seq_' subroutine.
. ./defs || Exit 1
unset stderr_fileno_ || :
: One-argument form.
exp="\
1
2
3
4
5"
got=`seq_ 5` || Exit 1
test x"$exp" = x"$got" || Exit 1
: Two-arguments form.
exp="\
7
8
9
10
11"
got=`seq_ 7 11` || Exit 1
test x"$exp" = x"$got" || Exit 1
: Three-arguments form [1].
exp="\
120
125
130
135"
got=`seq_ 120 5 135` || Exit 1
test x"$exp" = x"$got" || Exit 1
: Three-arguments form [2].
exp="\
13
17
21"
got=`seq_ 13 4 23` || Exit 1
test x"$exp" = x"$got" || Exit 1
: No argument is an error.
st=0
(seq_) 2>stderr || st=$?
test $st -eq 99
grep 'seq_: missing argument' stderr
: Four or more arguments is an error.
for args in '1 1 2 1' '1 1 1 1 1 1'; do
st=0
(seq_ $args) 2>stderr || st=$?
test $st -eq 99
grep 'seq_: too many arguments' stderr
done
: