home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / src / amiga / ed-0.1-src.lha / ed-0.1 / test / ckscripts.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1994-01-20  |  866 b   |  34 lines

  1. #!/bin/sh -
  2. # This script runs the .ed scripts generated by mkscripts.sh
  3. # and compares their output against the .r files, which contain
  4. # the correct output
  5.  
  6. PATH="/bin:/usr/bin:/usr/local/bin/:."
  7. ED=$1
  8. [ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; }
  9.  
  10. # Run the *.red scripts first, since these don't generate output;
  11. # they exit with non-zero status
  12. for i in *.red; do
  13.     echo $i
  14.     if $i; then
  15.         echo "*** The script $i exited abnormally  ***"
  16.     fi
  17. done >errs.o 2>&1
  18.  
  19. # Run the remainding scripts; they exit with zero status
  20. for i in *.ed; do
  21. #    base=`expr $i : '\([^.]*\)'`
  22. #    base=`echo $i | sed 's/\..*//'`
  23.     base=`$ED - \!"echo $i" <<-EOF
  24.         s/\..*
  25.     EOF`
  26.     if $base.ed; then
  27.         if cmp -s $base.o $base.r; then :; else
  28.             echo "*** Output $base.o of script $i is incorrect ***"
  29.         fi
  30.     else
  31.         echo "*** The script $i exited abnormally ***"
  32.     fi
  33. done >scripts.o 2>&1
  34.