summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-01-23 04:12:43 +0000
committerJim Meyering <jim@meyering.net>1997-01-23 04:12:43 +0000
commitb66a30133ffebbb8638999d95292fdd21c9621da (patch)
tree0dadb5a9691156c82bae6c0f966d5c195b1bf9cb /tests
parent598a7bda467d7bdca3dcf1923503e00ddd554a2b (diff)
downloadcoreutils-b66a30133ffebbb8638999d95292fdd21c9621da.tar.xz
.
Diffstat (limited to 'tests')
-rw-r--r--tests/tail/Makefile.am6
-rw-r--r--tests/tail/Makefile.in6
-rwxr-xr-xtests/tail/Test.pm11
-rwxr-xr-xtests/tail/tail-tests87
4 files changed, 104 insertions, 6 deletions
diff --git a/tests/tail/Makefile.am b/tests/tail/Makefile.am
index 13480eff6..be5cf02c6 100644
--- a/tests/tail/Makefile.am
+++ b/tests/tail/Makefile.am
@@ -11,7 +11,8 @@ tobs-3.in tobs-3.exp tobs-4.in tobs-4.exp tobs-5.in tobs-5.exp tobsx-1.in \
tobsx-1.exp tobsx-2.in tobsx-2.exp tobs-l.in tobs-l.exp terr-1.in terr-1.exp \
terr-2.in terr-2.exp terr-3.in terr-3.exp terr-4.in terr-4.exp tstdin-1.in \
tstdin-1.exp tstdin-2.in tstdin-2.exp tn-1.in tn-1.exp tn-2.in tn-2.exp \
-tn-3.in tn-3.exp
+tn-3.in tn-3.exp tn-4.in tn-4.exp tn-4a.in tn-4a.exp tn-5.in tn-5.exp \
+tn-5a.in tn-5a.exp tn-5b.in tn-5b.exp
run_gen = tobs-c1.out tobs-c1.err tobs-c2.out tobs-c2.err tobs-c3.out \
tobs-c3.err tobs-c4.out tobs-c4.err tobs-c5.out tobs-c5.err tobs-l1.out \
tobs-l1.err tobs-l2.out tobs-l2.err tobs-l3.out tobs-l3.err tobs-l4.out \
@@ -20,7 +21,8 @@ tobs-2.err tobs-3.out tobs-3.err tobs-4.out tobs-4.err tobs-5.out tobs-5.err \
tobsx-1.out tobsx-1.err tobsx-2.out tobsx-2.err tobs-l.out tobs-l.err \
terr-1.out terr-1.err terr-2.out terr-2.err terr-3.out terr-3.err terr-4.out \
terr-4.err tstdin-1.out tstdin-1.err tstdin-2.out tstdin-2.err tn-1.out \
-tn-1.err tn-2.out tn-2.err tn-3.out tn-3.err
+tn-1.err tn-2.out tn-2.err tn-3.out tn-3.err tn-4.out tn-4.err tn-4a.out \
+tn-4a.err tn-5.out tn-5.err tn-5a.out tn-5a.err tn-5b.out tn-5b.err
##test-files-end
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
diff --git a/tests/tail/Makefile.in b/tests/tail/Makefile.in
index ae4063a13..4356c60b0 100644
--- a/tests/tail/Makefile.in
+++ b/tests/tail/Makefile.in
@@ -52,7 +52,8 @@ tobs-3.in tobs-3.exp tobs-4.in tobs-4.exp tobs-5.in tobs-5.exp tobsx-1.in \
tobsx-1.exp tobsx-2.in tobsx-2.exp tobs-l.in tobs-l.exp terr-1.in terr-1.exp \
terr-2.in terr-2.exp terr-3.in terr-3.exp terr-4.in terr-4.exp tstdin-1.in \
tstdin-1.exp tstdin-2.in tstdin-2.exp tn-1.in tn-1.exp tn-2.in tn-2.exp \
-tn-3.in tn-3.exp
+tn-3.in tn-3.exp tn-4.in tn-4.exp tn-4a.in tn-4a.exp tn-5.in tn-5.exp \
+tn-5a.in tn-5a.exp tn-5b.in tn-5b.exp
run_gen = tobs-c1.out tobs-c1.err tobs-c2.out tobs-c2.err tobs-c3.out \
tobs-c3.err tobs-c4.out tobs-c4.err tobs-c5.out tobs-c5.err tobs-l1.out \
tobs-l1.err tobs-l2.out tobs-l2.err tobs-l3.out tobs-l3.err tobs-l4.out \
@@ -61,7 +62,8 @@ tobs-2.err tobs-3.out tobs-3.err tobs-4.out tobs-4.err tobs-5.out tobs-5.err \
tobsx-1.out tobsx-1.err tobsx-2.out tobsx-2.err tobs-l.out tobs-l.err \
terr-1.out terr-1.err terr-2.out terr-2.err terr-3.out terr-3.err terr-4.out \
terr-4.err tstdin-1.out tstdin-1.err tstdin-2.out tstdin-2.err tn-1.out \
-tn-1.err tn-2.out tn-2.err tn-3.out tn-3.err
+tn-1.err tn-2.out tn-2.err tn-3.out tn-3.err tn-4.out tn-4.err tn-4a.out \
+tn-4a.err tn-5.out tn-5.err tn-5a.out tn-5a.err tn-5b.out tn-5b.err
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
diff --git a/tests/tail/Test.pm b/tests/tail/Test.pm
index 052e79a53..5a0fddad9 100755
--- a/tests/tail/Test.pm
+++ b/tests/tail/Test.pm
@@ -42,7 +42,7 @@ my @tv = (
# Since the number is larger than 2^64, this should provoke
# the diagnostic: `tail: 99999999999999999999: number of bytes is so large \
-# that it is not representable' on all systems... for now, probably, maybe.
+# that it is not representable' on all systems... probably, for now, maybe.
['err-3', '-c99999999999999999999', '', '', 1],
['err-4', '-c', '', '', 1],
@@ -53,6 +53,15 @@ my @tv = (
['n-1', '-n 10', "x\n" . ("y\n" x 10) . 'z', ("y\n" x 9) . 'z', 0],
['n-2', '-n -10', "x\n" . ("y\n" x 10) . 'z', ("y\n" x 9) . 'z', 0],
['n-3', '-n +10', "x\n" . ("y\n" x 10) . 'z', "y\ny\nz", 0],
+
+# Accept +0 as synonym for +1.
+['n-4', '-n +0', "y\n" x 5, "y\n" x 5, 0],
+['n-4a', '-n +1', "y\n" x 5, "y\n" x 5, 0],
+
+# Note that -0 is *not* a synonym for -1.
+['n-5', '-n -0', "y\n" x 5, '', 0],
+['n-5a', '-n -1', "y\n" x 5, "y\n", 0],
+['n-5b', '-n 0', "y\n" x 5, '', 0],
);
sub test_vector
diff --git a/tests/tail/tail-tests b/tests/tail/tail-tests
index 59fd2fdca..c59274f95 100755
--- a/tests/tail/tail-tests
+++ b/tests/tail/tail-tests
@@ -468,8 +468,93 @@ else
esac
fi
test -s tn-3.err || rm -f tn-3.err
+$xx -n +0 < $srcdir/tn-4.in > tn-4.out 2> tn-4.err
+code=$?
+if test $code != 0 ; then
+ $echo Test n-4 failed: ../../src/tail return code $code differs from expected value 0 1>&2
+ errors=`expr $errors + 1`
+else
+ cmp tn-4.out $srcdir/tn-4.exp
+ case $? in
+ 0) if test "$VERBOSE" ; then $echo passed n-4; fi ;; # equal files
+ 1) $echo Test n-4 failed: files tn-4.out and $srcdir/tn-4.exp differ 1>&2;
+ errors=`expr $errors + 1` ;;
+ 2) $echo Test n-4 may have failed. 1>&2;
+ $echo The command "cmp tn-4.out $srcdir/tn-4.exp" failed. 1>&2 ;
+ errors=`expr $errors + 1` ;;
+ esac
+fi
+test -s tn-4.err || rm -f tn-4.err
+$xx -n +1 < $srcdir/tn-4a.in > tn-4a.out 2> tn-4a.err
+code=$?
+if test $code != 0 ; then
+ $echo Test n-4a failed: ../../src/tail return code $code differs from expected value 0 1>&2
+ errors=`expr $errors + 1`
+else
+ cmp tn-4a.out $srcdir/tn-4a.exp
+ case $? in
+ 0) if test "$VERBOSE" ; then $echo passed n-4a; fi ;; # equal files
+ 1) $echo Test n-4a failed: files tn-4a.out and $srcdir/tn-4a.exp differ 1>&2;
+ errors=`expr $errors + 1` ;;
+ 2) $echo Test n-4a may have failed. 1>&2;
+ $echo The command "cmp tn-4a.out $srcdir/tn-4a.exp" failed. 1>&2 ;
+ errors=`expr $errors + 1` ;;
+ esac
+fi
+test -s tn-4a.err || rm -f tn-4a.err
+$xx -n -0 < $srcdir/tn-5.in > tn-5.out 2> tn-5.err
+code=$?
+if test $code != 0 ; then
+ $echo Test n-5 failed: ../../src/tail return code $code differs from expected value 0 1>&2
+ errors=`expr $errors + 1`
+else
+ cmp tn-5.out $srcdir/tn-5.exp
+ case $? in
+ 0) if test "$VERBOSE" ; then $echo passed n-5; fi ;; # equal files
+ 1) $echo Test n-5 failed: files tn-5.out and $srcdir/tn-5.exp differ 1>&2;
+ errors=`expr $errors + 1` ;;
+ 2) $echo Test n-5 may have failed. 1>&2;
+ $echo The command "cmp tn-5.out $srcdir/tn-5.exp" failed. 1>&2 ;
+ errors=`expr $errors + 1` ;;
+ esac
+fi
+test -s tn-5.err || rm -f tn-5.err
+$xx -n -1 < $srcdir/tn-5a.in > tn-5a.out 2> tn-5a.err
+code=$?
+if test $code != 0 ; then
+ $echo Test n-5a failed: ../../src/tail return code $code differs from expected value 0 1>&2
+ errors=`expr $errors + 1`
+else
+ cmp tn-5a.out $srcdir/tn-5a.exp
+ case $? in
+ 0) if test "$VERBOSE" ; then $echo passed n-5a; fi ;; # equal files
+ 1) $echo Test n-5a failed: files tn-5a.out and $srcdir/tn-5a.exp differ 1>&2;
+ errors=`expr $errors + 1` ;;
+ 2) $echo Test n-5a may have failed. 1>&2;
+ $echo The command "cmp tn-5a.out $srcdir/tn-5a.exp" failed. 1>&2 ;
+ errors=`expr $errors + 1` ;;
+ esac
+fi
+test -s tn-5a.err || rm -f tn-5a.err
+$xx -n 0 < $srcdir/tn-5b.in > tn-5b.out 2> tn-5b.err
+code=$?
+if test $code != 0 ; then
+ $echo Test n-5b failed: ../../src/tail return code $code differs from expected value 0 1>&2
+ errors=`expr $errors + 1`
+else
+ cmp tn-5b.out $srcdir/tn-5b.exp
+ case $? in
+ 0) if test "$VERBOSE" ; then $echo passed n-5b; fi ;; # equal files
+ 1) $echo Test n-5b failed: files tn-5b.out and $srcdir/tn-5b.exp differ 1>&2;
+ errors=`expr $errors + 1` ;;
+ 2) $echo Test n-5b may have failed. 1>&2;
+ $echo The command "cmp tn-5b.out $srcdir/tn-5b.exp" failed. 1>&2 ;
+ errors=`expr $errors + 1` ;;
+ esac
+fi
+test -s tn-5b.err || rm -f tn-5b.err
if test $errors = 0 ; then
- $echo Passed all 27 tests. 1>&2
+ $echo Passed all 32 tests. 1>&2
else
$echo Failed $errors tests. 1>&2
fi