repl test

This commit is contained in:
2024-01-04 13:06:05 +01:00
parent 49de281083
commit 7fef17ca01
4 changed files with 40 additions and 5 deletions

View File

@@ -0,0 +1,9 @@
(+ 2 3)
(if (= testin (read)) ok bad)
testin
(eval (read))
(+ 4 5)
(define (equal a b)(if (nil? a) (if (nil? b) 1 0)(if (atom a)(if (atom b) (= a b) 0)(if (atom b) 0 (if (equal (car a) (car b)) (equal (cdr a) (cdr b)) 0)))))
(if (equal (quote(a b)) (read)) ok bad)
(a b)
(quit)

View File

@@ -0,0 +1,5 @@
> 5
> ok
> 9
> > ok
>

View File

@@ -22,6 +22,25 @@ for FILE in *.test.psil; do
rm $FILE.res
done
for FILE in *.testi.psil; do
echo "TESTING INTERACTIVE $FILE"
$PSIL --repl+ --default_log_level:0 < $FILE > $FILE.res
if [ $? -ne 0 ]; then
FAILED+=("test-"$FILE)
continue
fi
diff -w $FILE.res $FILE.ex
if [ $? -ne 0 ]; then
FAILED+=("test-"$FILE)
continue
fi
echo "$FILE OK"
rm $FILE.res
done
if [ ${#FAILED[@]} -eq 0 ]; then
echo "ALL TESTS PASSED"
else