shithub: mc

Download patch

ref: a4cbb62ba8522be1d2a0b6aedeafd542fb22f713
parent: 02b6e7e3d1985fccba1e35dc9eaff61482b67c1b
author: Ori Bernstein <[email protected]>
date: Thu Jun 7 15:09:14 EDT 2012

Add ability to test compilation failure.

--- a/test/test.sh
+++ b/test/test.sh
@@ -32,16 +32,25 @@
     fi
 }
 
-for i in `awk '{print $1}' tests`; do
+for i in `awk '/B/{print $2}' tests`; do
     build $i
 done
 
+for i in `awk '/F/{print $2}' tests`; do
+    build $i
+    if [ $? -ne '0' ]; then
+        echo "PASS: $i"
+    else
+        echo "FAIL: $i"
+    fi
+done
+
 export IFS='
 '
-for i in `cat tests`; do
-    tst=`echo $i | awk '{print $1}'`
-    type=`echo $i | awk '{print $2}'`
-    val=`echo $i | awk '{print $3}'`
+for i in `awk '/B/{print $0}' tests`; do
+    tst=`echo $i | awk '{print $2}'`
+    type=`echo $i | awk '{print $3}'`
+    val=`echo $i | awk '{print $4}'`
     case $type in
         E) exitswith $tst $val ;;
         P) prints $tst $val ;;
--- a/test/tests
+++ b/test/tests
@@ -1,17 +1,17 @@
-main	E	0
-add	E	53
-mul     E       84
-div     E       42
-mod     E       6
-bsr     E       5
-struct1	E	12
-struct	E	42
-array	E	7
-call	E	42
-loop	E	45
-fib	E	21
-slice	E	7
-float   E       1
-structasn       E       42
-log-and E       0
-log-or  E       1
+B main		E	0
+B add		E	53
+B mul     	E       84
+B div     	E       42
+B mod     	E       6
+B bsr     	E       5
+B struct1		E	12
+B struct		E	42
+B array		E	7
+B call		E	42
+B loop		E	45
+B fib		E	21
+B slice		E	7
+B float   	E       1
+B structasn	E       42
+B log-and 	E       0
+B log-or  	E       1