diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tail/Makefile.am | 6 | ||||
-rw-r--r-- | tests/tail/Makefile.in | 6 | ||||
-rwxr-xr-x | tests/tail/Test.pm | 6 | ||||
-rwxr-xr-x | tests/tail/tail-tests | 53 |
4 files changed, 65 insertions, 6 deletions
diff --git a/tests/tail/Makefile.am b/tests/tail/Makefile.am index 6131455d2..13480eff6 100644 --- a/tests/tail/Makefile.am +++ b/tests/tail/Makefile.am @@ -10,7 +10,8 @@ tobs-l4.exp tobs-l5.in tobs-l5.exp tobs-1.in tobs-1.exp tobs-2.in tobs-2.exp \ 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 +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 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 \ @@ -18,7 +19,8 @@ tobs-l4.err tobs-l5.out tobs-l5.err tobs-1.out tobs-1.err tobs-2.out \ 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 +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 ##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 f42a6647f..ae4063a13 100644 --- a/tests/tail/Makefile.in +++ b/tests/tail/Makefile.in @@ -51,7 +51,8 @@ tobs-l4.exp tobs-l5.in tobs-l5.exp tobs-1.in tobs-1.exp tobs-2.in tobs-2.exp \ 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 +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 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 \ @@ -59,7 +60,8 @@ tobs-l4.err tobs-l5.out tobs-l5.err tobs-1.out tobs-1.err tobs-2.out \ 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 +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 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 c0936e1e5..052e79a53 100755 --- a/tests/tail/Test.pm +++ b/tests/tail/Test.pm @@ -46,9 +46,13 @@ my @tv = ( ['err-3', '-c99999999999999999999', '', '', 1], ['err-4', '-c', '', '', 1], -# Same as -l 10 +# Same as -n 10 ['stdin-1', '-', '', '', 0], ['stdin-2', '-', "x\n" . ("y\n" x 10) . 'z', ("y\n" x 9) . 'z', 0], + +['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], ); sub test_vector diff --git a/tests/tail/tail-tests b/tests/tail/tail-tests index 9c554642b..59fd2fdca 100755 --- a/tests/tail/tail-tests +++ b/tests/tail/tail-tests @@ -417,8 +417,59 @@ else esac fi test -s tstdin-2.err || rm -f tstdin-2.err +$xx -n 10 < $srcdir/tn-1.in > tn-1.out 2> tn-1.err +code=$? +if test $code != 0 ; then + $echo Test n-1 failed: ../../src/tail return code $code differs from expected value 0 1>&2 + errors=`expr $errors + 1` +else + cmp tn-1.out $srcdir/tn-1.exp + case $? in + 0) if test "$VERBOSE" ; then $echo passed n-1; fi ;; # equal files + 1) $echo Test n-1 failed: files tn-1.out and $srcdir/tn-1.exp differ 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo Test n-1 may have failed. 1>&2; + $echo The command "cmp tn-1.out $srcdir/tn-1.exp" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s tn-1.err || rm -f tn-1.err +$xx -n -10 < $srcdir/tn-2.in > tn-2.out 2> tn-2.err +code=$? +if test $code != 0 ; then + $echo Test n-2 failed: ../../src/tail return code $code differs from expected value 0 1>&2 + errors=`expr $errors + 1` +else + cmp tn-2.out $srcdir/tn-2.exp + case $? in + 0) if test "$VERBOSE" ; then $echo passed n-2; fi ;; # equal files + 1) $echo Test n-2 failed: files tn-2.out and $srcdir/tn-2.exp differ 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo Test n-2 may have failed. 1>&2; + $echo The command "cmp tn-2.out $srcdir/tn-2.exp" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s tn-2.err || rm -f tn-2.err +$xx -n +10 < $srcdir/tn-3.in > tn-3.out 2> tn-3.err +code=$? +if test $code != 0 ; then + $echo Test n-3 failed: ../../src/tail return code $code differs from expected value 0 1>&2 + errors=`expr $errors + 1` +else + cmp tn-3.out $srcdir/tn-3.exp + case $? in + 0) if test "$VERBOSE" ; then $echo passed n-3; fi ;; # equal files + 1) $echo Test n-3 failed: files tn-3.out and $srcdir/tn-3.exp differ 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo Test n-3 may have failed. 1>&2; + $echo The command "cmp tn-3.out $srcdir/tn-3.exp" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s tn-3.err || rm -f tn-3.err if test $errors = 0 ; then - $echo Passed all 24 tests. 1>&2 + $echo Passed all 27 tests. 1>&2 else $echo Failed $errors tests. 1>&2 fi |