gno/bin/head/tests/dotests
1997-10-03 03:56:35 +00:00

97 lines
2.6 KiB
Plaintext

# Tests for head command; invoked by command file "fulltests"
# Written by Dave Tribby (August 1997)
# $Id: dotests,v 1.2 1997/10/03 03:56:35 gdr Exp $
# Location of the head command to be tested
set testcmd="../head"
# Record starting time
echo -n "Testing command $testcmd beginning at"
date
set src="file500.txt"
set cmp="f500.10l"
set dest="/tmp/$cmp"
echo "Listing first ten lines (default) of $src"
$testcmd $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set dest="/tmp/${cmp}A"
echo "Listing first ten lines (default) of $src using stdin"
$testcmd < $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set dest="/tmp/${cmp}B"
echo "Listing first ten lines (explicit) of $src"
$testcmd -n 10 $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set dest="/tmp/${cmp}C"
echo "Listing first ten lines (obsolescent) of $src"
$testcmd -10 $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="f500.90c"
set dest="/tmp/$cmp"
echo "Listing first 90 chars of $src"
$testcmd -c 90 $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="multi.out"
set dest="/tmp/$cmp"
echo "Listing first 3 lines of f*.*"
$testcmd -n 3 f*.* > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
echo "***** Error Messages *****"
set dest="/tmp/err.cond"
echo ""
echo "Expected error: illegal option"
$testcmd -x $src > $dest
echo " Error completion status = $status (expected: 1)"
echo ""
echo "Expected error: illegal byte count"
$testcmd -c 12x $src > $dest
echo " Error completion status = $status (expected: 1)"
echo ""
echo "Expected error: can't combine line and byte counts"
$testcmd -n 12 -c 12 $src > $dest
echo " Error completion status = $status (expected: 1)"
echo ""
set src="badname"
echo "Expected error: $src: no such file or directory"
$testcmd $src > $dest
echo " Error completion status = $status (expected: 1)"