diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/myed_test.sh | 33 | ||||
-rw-r--r-- | tests/test_addr.ed | 12 | ||||
-rw-r--r-- | tests/test_incr.ed | 18 | ||||
-rw-r--r-- | tests/test_insapp.ed | 33 | ||||
-rw-r--r-- | tests/testlist.txt | 4 |
5 files changed, 100 insertions, 0 deletions
diff --git a/tests/myed_test.sh b/tests/myed_test.sh new file mode 100755 index 0000000..4c551a4 --- /dev/null +++ b/tests/myed_test.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +##set -x + +FIN=${1:-"/dev/stdin"} + +while read EDFILE EDSOURCE; do + + + IGN=$(echo ${EDFILE} | grep -c "^#") + if [ $IGN = "0" ]; then + printf "test: $EDFILE..." + + FILE1=$(tempfile) + FILE2=$(tempfile) + + cat ${EDFILE} | /bin/ed ${EDSOURCE} > ${FILE1} 2>/dev/null + cat ${EDFILE} | ../myed ${EDSOURCE} > ${FILE2} 2>/dev/null + + ret=$(diff $FILE1 $FILE2 | tee ${EDFILE}.last_diff | wc -l) + + [ "$ret" = "0" ] && echo " PASSED" && rm ${EDFILE}.last_diff + + [ "$ret" != "0" ] && echo " FAILED (log in ${EDFILE}.last_diff)" + rm $FILE1 $FILE2 + else + echo "${EDFILE}: SKIPPED" + fi + + + + +done <$FIN diff --git a/tests/test_addr.ed b/tests/test_addr.ed new file mode 100644 index 0000000..04a7d83 --- /dev/null +++ b/tests/test_addr.ed @@ -0,0 +1,12 @@ +1 +1p +10n +2,20n +2,20p +,p +,n +,2n +115 +-,+n +-,+1n +q diff --git a/tests/test_incr.ed b/tests/test_incr.ed new file mode 100644 index 0000000..7e7df29 --- /dev/null +++ b/tests/test_incr.ed @@ -0,0 +1,18 @@ +1 ++p +++n +20+ +21+p +30++--n +15+10,15++20n +++--,+++++p +117 ++++ +--- ++++10 ++++---5 +1++++++n +31+10+10 +110+-++--10 +q +q diff --git a/tests/test_insapp.ed b/tests/test_insapp.ed new file mode 100644 index 0000000..fffc3cd --- /dev/null +++ b/tests/test_insapp.ed @@ -0,0 +1,33 @@ +10i +this is a new line +. +1,20n +$i +this should be towards +the +end +. +$-10,$n +0i +head +. +1,3n +25a +another line here +and here +. +20,30n +0a +at +the beginning +. +1,10n +$ +a +...and at +the +end +. +$-10,$n +q +q diff --git a/tests/testlist.txt b/tests/testlist.txt new file mode 100644 index 0000000..df9ca98 --- /dev/null +++ b/tests/testlist.txt @@ -0,0 +1,4 @@ +test_addr.ed pippo.c +#test_pippo.ed oejn +test_incr.ed pippo.c +test_insapp.ed pippo.c |