diff options
Diffstat (limited to 'tests/myed_test.sh')
-rwxr-xr-x | tests/myed_test.sh | 33 |
1 files changed, 33 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 |