summaryrefslogtreecommitdiff
path: root/tests/myed_test.sh
blob: 4c551a4479141c7b687db6980f678932166fad25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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