diff options
author | alm <alm@FreeBSD.org> | 1994-02-01 00:36:28 +0000 |
---|---|---|
committer | alm <alm@FreeBSD.org> | 1994-02-01 00:36:28 +0000 |
commit | 26c84d7dc70d00b072b13a5757625006586fdede (patch) | |
tree | c82867e2169de15c590a9d6a1c65adf6483131e8 /bin/ed/test | |
parent | 40ec390772e2e083a7986558226c3cc6b72c7378 (diff) | |
download | FreeBSD-src-26c84d7dc70d00b072b13a5757625006586fdede.zip FreeBSD-src-26c84d7dc70d00b072b13a5757625006586fdede.tar.gz |
Fixed range address bug: 1,2, == 2,2 not 2,.
Overhauled the name space, reworked some modules and removed the
obsolescent Addison-Wesley copyright.
Diffstat (limited to 'bin/ed/test')
-rw-r--r-- | bin/ed/test/Makefile | 24 | ||||
-rw-r--r-- | bin/ed/test/README | 11 | ||||
-rw-r--r-- | bin/ed/test/addr.d | 9 | ||||
-rw-r--r-- | bin/ed/test/addr.r | 2 | ||||
-rw-r--r-- | bin/ed/test/addr.t | 5 | ||||
-rw-r--r-- | bin/ed/test/ckscripts.sh | 20 | ||||
-rw-r--r-- | bin/ed/test/g5.d | 3 | ||||
-rw-r--r-- | bin/ed/test/g5.r | 9 | ||||
-rw-r--r-- | bin/ed/test/g5.t | 2 | ||||
-rw-r--r-- | bin/ed/test/mkscripts.sh | 112 |
10 files changed, 111 insertions, 86 deletions
diff --git a/bin/ed/test/Makefile b/bin/ed/test/Makefile index ca45a51..84166c1 100644 --- a/bin/ed/test/Makefile +++ b/bin/ed/test/Makefile @@ -1,17 +1,23 @@ +SHELL= /bin/sh ED= ../obj/ed -all: build test - @echo done +all: check + @: + +check: build test + @if grep -h '\*\*\*' errs.o scripts.o; then :; else \ + echo "tests completed successfully."; \ + fi build: mkscripts.sh - @echo building test scripts... - @chmod +x mkscripts.sh - @./mkscripts.sh ${ED} + @if [ -f errs.o ]; then :; else \ + echo "building test scripts for $(ED) ..."; \ + $(SHELL) mkscripts.sh $(ED); \ + fi test: build ckscripts.sh - @echo running test scripts... - @chmod +x ckscripts.sh - @./ckscripts.sh ${ED} + @echo testing $(ED) ... + @$(SHELL) ckscripts.sh $(ED) clean: - rm -f *.ed *.[oz] *~ + rm -f *.ed *.red *.[oz] *~ diff --git a/bin/ed/test/README b/bin/ed/test/README index 8917f36..ab66b92 100644 --- a/bin/ed/test/README +++ b/bin/ed/test/README @@ -19,14 +19,6 @@ which look like: or: *** Output u.o of script u.ed is incorrect *** -It is assumed that the ed being tested processes escapes (\) in file names. -This is so that a name starting with bang (!) can be read, via: - r \!file -Without the escape, a POSIX ed would attempt to read the output of -the shell command `file'. If the ed being tested does not support escape -processing on file names, then the script `mkscripts.sh' should be modified -accordingly. - The POSIX requirement that an address range not be used where at most a single address is expected has been relaxed in this version of ed. Therefore, the following scripts which test for compliance with this @@ -36,6 +28,3 @@ a1-err.ed i1-err.ed k1-err.ed r1-err.ed - -In addition, one of bang1-err.ed or bang2.ed will fail, depending on whether or -not ed was compiled with the VI_BANG directive. diff --git a/bin/ed/test/addr.d b/bin/ed/test/addr.d new file mode 100644 index 0000000..8f7ba1b --- /dev/null +++ b/bin/ed/test/addr.d @@ -0,0 +1,9 @@ +line 1 +line 2 +line 3 +line 4 +line5 +1ine6 +line7 +line8 +line9 diff --git a/bin/ed/test/addr.r b/bin/ed/test/addr.r new file mode 100644 index 0000000..04caf17 --- /dev/null +++ b/bin/ed/test/addr.r @@ -0,0 +1,2 @@ +line 2 +line9 diff --git a/bin/ed/test/addr.t b/bin/ed/test/addr.t new file mode 100644 index 0000000..750b224 --- /dev/null +++ b/bin/ed/test/addr.t @@ -0,0 +1,5 @@ +1 d +1 1 d +1,2,d +1;+ + ,d +1,2;., + 2d diff --git a/bin/ed/test/ckscripts.sh b/bin/ed/test/ckscripts.sh index 87a7e9b..edc935d 100644 --- a/bin/ed/test/ckscripts.sh +++ b/bin/ed/test/ckscripts.sh @@ -5,26 +5,24 @@ PATH="/bin:/usr/bin:/usr/local/bin/:." ED=$1 -[ X"$ED" = X -o ! -x $ED ] && ED="../ed" [ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; } -# Run the *-err.ed scripts first, since these don't generate output; -# rename then to *-err.ed~; they exit with non-zero status -for i in *-err.ed; do - echo $i~ +# Run the *.red scripts first, since these don't generate output; +# they exit with non-zero status +for i in *.red; do + echo $i if $i; then - echo "*** The script $i~ exited abnormally ***" + echo "*** The script $i exited abnormally ***" fi - mv $i $i~ done >errs.o 2>&1 # Run the remainding scripts; they exit with zero status for i in *.ed; do - base=`expr $i : '\([^.]*\)'` +# base=`expr $i : '\([^.]*\)'` # base=`echo $i | sed 's/\..*//'` -# base=`$ED - \!"echo \\\\$i" <<-EOF -# s/\..* -# EOF` + base=`$ED - \!"echo $i" <<-EOF + s/\..* + EOF` if $base.ed; then if cmp -s $base.o $base.r; then :; else echo "*** Output $base.o of script $i is incorrect ***" diff --git a/bin/ed/test/g5.d b/bin/ed/test/g5.d new file mode 100644 index 0000000..a92d664 --- /dev/null +++ b/bin/ed/test/g5.d @@ -0,0 +1,3 @@ +line 1 +line 2 +line 3 diff --git a/bin/ed/test/g5.r b/bin/ed/test/g5.r new file mode 100644 index 0000000..15a2675 --- /dev/null +++ b/bin/ed/test/g5.r @@ -0,0 +1,9 @@ +line 1 +line 2 +line 3 +line 2 +line 3 +line 1 +line 3 +line 1 +line 2 diff --git a/bin/ed/test/g5.t b/bin/ed/test/g5.t new file mode 100644 index 0000000..e213481 --- /dev/null +++ b/bin/ed/test/g5.t @@ -0,0 +1,2 @@ +g/./1,3t$\ +1d diff --git a/bin/ed/test/mkscripts.sh b/bin/ed/test/mkscripts.sh index 724db0c..fa3147f 100644 --- a/bin/ed/test/mkscripts.sh +++ b/bin/ed/test/mkscripts.sh @@ -3,69 +3,71 @@ PATH="/bin:/usr/bin:/usr/local/bin/:." ED=$1 -[ X"$ED" = X -o ! -x $ED ] && ED="../ed" [ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; } for i in *.t; do # base=${i%.*} # base=`echo $i | sed 's/\..*//'` - base=`expr $i : '\([^.]*\)'` - ( - echo "#!/bin/sh -" - echo "$ED - <<\EOT" - echo "r \\$base.d" - cat $i - echo "w \\$base.o" - echo EOT - ) >$base.ed - chmod +x $base.ed -# The following is pretty ugly and not appropriate use of ed -# but the point is that it can be done... -# base=`$ED - \!"echo \\\\$i" <<-EOF -# s/\..* -# EOF` -# $ED - <<-EOF -# a -# #!/bin/sh - -# $ED - <<\EOT -# r \\$base.d -# w \\$base.o -# EOT -# . -# -2r \\$i -# w \\$base.ed -# !chmod +x \\$base.ed -# EOF +# base=`expr $i : '\([^.]*\)'` +# ( +# echo "#!/bin/sh -" +# echo "$ED - <<\EOT" +# echo "r $base.d" +# cat $i +# echo "w $base.o" +# echo EOT +# ) >$base.ed +# chmod +x $base.ed +# The following is pretty ugly way of doing the above, and not appropriate +# use of ed but the point is that it can be done... + base=`$ED - \!"echo $i" <<-EOF + s/\..* + EOF` + $ED - <<-EOF + a + #!/bin/sh - + $ED - <<\EOT + H + r $base.d + w $base.o + EOT + . + -2r $i + w $base.ed + !chmod +x $base.ed + EOF done for i in *.err; do # base=${i%.*} # base=`echo $i | sed 's/\..*//'` - base=`expr $i : '\([^.]*\)'` - ( - echo "#!/bin/sh -" - echo "$ED - <<\EOT" - echo H - echo "r \\$base.err" - cat $i - echo "w \\$base.o" - echo EOT - ) >$base-err.ed - chmod +x $base-err.ed -# base=`$ED - \!"echo \\\\$i" <<-EOF -# s/\..* -# EOF` -# $ED - <<-EOF -# a -# #!/bin/sh - -# $ED - <<\EOT -# H -# r \\$base.err -# w \\$base.o -# EOT -# . -# -2r \\$i -# w \\${base}-err.ed -# !chmod +x ${base}-err.ed -# EOF +# base=`expr $i : '\([^.]*\)'` +# ( +# echo "#!/bin/sh -" +# echo "$ED - <<\EOT" +# echo H +# echo "r $base.err" +# cat $i +# echo "w $base.o" +# echo EOT +# ) >$base-err.ed +# chmod +x $base-err.ed +# The following is pretty ugly way of doing the above, and not appropriate +# use of ed but the point is that it can be done... + base=`$ED - \!"echo $i" <<-EOF + s/\..* + EOF` + $ED - <<-EOF + a + #!/bin/sh - + $ED - <<\EOT + H + r $base.err + w $base.o + EOT + . + -2r $i + w ${base}.red + !chmod +x ${base}.red + EOF done |