summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2018-05-30 06:29:18 +0100
committerKatolaZ <katolaz@freaknet.org>2018-05-30 06:29:18 +0100
commit652ef404582555d9f7fca855424108a57cdea3ad (patch)
treeb9106730be79381027b50fd48bd3b99c5400a6ac /tests
parent8a4e57da301445ae4ad7bf06a7ce18c3091ac9df (diff)
Reimplemented (and fixed) insert/append
Diffstat (limited to 'tests')
-rwxr-xr-xtests/myed_test.sh33
-rw-r--r--tests/test_addr.ed12
-rw-r--r--tests/test_incr.ed18
-rw-r--r--tests/test_insapp.ed33
-rw-r--r--tests/testlist.txt4
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