summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-12-25 22:11:53 -0800
committerOri Bernstein <ori@eigenstate.org>2014-12-25 22:11:53 -0800
commitfb88daaedf549fd7e232c7c44d7b37e5f11ec4fc (patch)
tree267ba104e922230d1c462c960fba0f70d36a93d2 /test
parentf66159ce8e05236160a26aacf3facdb94d50077e (diff)
downloadmc-fb88daaedf549fd7e232c7c44d7b37e5f11ec4fc.tar.gz
Get testing closer to working on plan9.
Diffstat (limited to 'test')
-rw-r--r--test/runtest.rc94
-rwxr-xr-xtest/runtest.sh6
-rw-r--r--test/tests4
3 files changed, 99 insertions, 5 deletions
diff --git a/test/runtest.rc b/test/runtest.rc
new file mode 100644
index 0000000..d0621cb
--- /dev/null
+++ b/test/runtest.rc
@@ -0,0 +1,94 @@
+#!/bin/rc
+passed=""
+failed=""
+npassed=0
+nfailed=0
+
+fn build {
+ rm -f $1 $1^.o $1^.s $1^.use
+ ../myrbuild/6.out -b $1 -C../6/6.out -M../muse/6.out -I../libstd -r../rt/_myrrt.6 $1^.myr
+}
+
+fn pass {
+ passed=$passed ^ " " ^ $1
+}
+
+fn fail {
+ echo FAIL: $1
+ failed=$failed ^ " " ^ $1
+}
+
+fn expectstatus {
+ ./$1 $3
+ if(~ $status $2){
+ pass $1
+ return
+ }
+ if not {
+ fail $1
+ }
+}
+
+fn expectprint {
+ if(~ "`{./$1 $3}" "$2")
+ pass $1
+ if not
+ fail $1
+}
+
+fn expectcmp {
+ t="/tmp/myrtest-$1"
+ rm -f $t
+ ./$1 $3 > $t
+ if (cmp $t data/$1-expected)
+ pass $1
+ if not
+ fail $1
+}
+
+fn expectfcmp {
+ t="/tmp/myrtest-$1"
+ rm -f $t
+ ./$1 $3
+ if (cmp $2 data/$1-expected)
+ pass $1
+ if not
+ fail $1
+}
+
+fn B {
+ test=$1; shift
+ type=$1; shift
+ args=$1; shift
+
+ build $test
+ switch($type) {
+ case "E"
+ expectstatus $test $res
+ case "P"
+ expectprint $test $res
+ case "C"
+ expectcmp $test $res
+ case "F"
+ expectfcmp $test $res
+ }
+}
+
+fn F {
+ @{ build $1 } > /dev/null
+ if (~ $status "")
+ fail $1
+ if not
+ pass $1
+}
+
+
+. tests
+
+echo "PASSED $passed"
+if(~ $failed "")
+ echo SUCCESS
+if not
+ echo "FAILURES $failed"
+
+
diff --git a/test/runtest.sh b/test/runtest.sh
index 7d775b8..c941c15 100755
--- a/test/runtest.sh
+++ b/test/runtest.sh
@@ -77,9 +77,9 @@ function B {
fi
build $test
case $type in
- "E") expectstatus "$test" "$res" "$input";;
- "P") expectprint "$test" "$res" "$input";;
- "C") expectcompare "$test" "$res" "$input";;
+ "E") expectstatus "$test" "$res";;
+ "P") expectprint "$test" "$res";;
+ "C") expectcompare "$test" "$res";;
"F") expectfcompare "$test" "$res" "$args";;
esac
}
diff --git a/test/tests b/test/tests
index 7c8684f..a0d4e1b 100644
--- a/test/tests
+++ b/test/tests
@@ -88,8 +88,8 @@ B generictype E 0
B genericret E 42
B genericmatch E 15
B genericrec E 0
-# B genericchain P "val = 123" ## BUGGERED
-B genericmake P "val = 123"
+# B genericchain P 'val = 123' ## BUGGERED
+B genericmake P 'val = 123'
B genericuret E 42
B stdopt-some E 42
B stdopt-none E 42