commit ae14e7963b3eba512374a5c8819d23be57786cdf
parent 172dd9e56276d99a87564cba560ac177ff4c1eb6
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Fri, 3 Jun 2022 09:10:00 -0400
Move testasm.fs and testcc.fs to the test suite
Diffstat:
7 files changed, 27 insertions(+), 31 deletions(-)
diff --git a/boot.fs b/boot.fs
@@ -46,9 +46,10 @@ current to (psufl)
: .S ( -- )
S" SP " stype scnt .x1 spc> S" RS " stype rcnt .x1 spc>
S" -- " stype stack? psdump ;
-: create word entry compile (cell) ;
-: value word entry compile (val) , ;
-: alias ' word entry compile (alias) , ;
+: code word entry ;
+: create code compile (cell) ;
+: value code compile (val) , ;
+: alias ' code compile (alias) , ;
64 value LNSZ
create in( LNSZ allot
: in) in( 64 + ;
diff --git a/runtests.sh b/runtests.sh
@@ -1,12 +1,11 @@
#!/bin/bash
for fn in tests/test*; do
- if echo "bye" | cat tests/harness.fs $fn - | ./dusk; then
- echo
- echo "all tests passed"
- else
+ echo "Running $fn"
+ if !(echo "bye" | cat tests/harness.fs $fn - | ./dusk); then
echo
echo "tests failed"
+ exit 1
fi
done
-
+echo "all tests passed"
diff --git a/testasm.fs b/testasm.fs
@@ -1,10 +0,0 @@
-\ ./dusk < testasm.fs
-f<< asm.fs
-: spit ( a u -- ) >r >A begin Ac@+ .x1 spc> next ;
-here
-eax 42 i32 mov,
-ebp 4 i32 sub,
-[ebp] eax mov,
-ret,
-here over - spit
-bye
diff --git a/testcc.fs b/testcc.fs
@@ -1,12 +0,0 @@
-\ ./dusk < testcc.fs
-f<< wordtbl.fs
-f<< asm.fs
-f<< cc/tok.fs
-f<< cc/ast.fs
-f<< cc/cc1.fs
-: opentestc S" test.c" fopen not if abort" can't open" then ;
-opentestc
-' f< to cc<
-cc1,
-main .x
-bye
diff --git a/tests/harness.fs b/tests/harness.fs
@@ -3,4 +3,3 @@ exitonabort
\ # means "assert"
: # ( f -- ) not if abort" assertion failed" then ;
: #eq ( n n -- ) = # ;
-
diff --git a/tests/testasm.fs b/tests/testasm.fs
@@ -0,0 +1,8 @@
+f<< asm.fs
+code foo
+ eax 42 i32 mov,
+ ebp 4 i32 sub,
+ [ebp] eax mov,
+ ret,
+
+foo 42 #eq
diff --git a/tests/testcc.fs b/tests/testcc.fs
@@ -0,0 +1,11 @@
+\ Tests for the C compiler
+f<< wordtbl.fs
+f<< asm.fs
+f<< cc/tok.fs
+f<< cc/ast.fs
+f<< cc/cc1.fs
+: opentestc S" test.c" fopen not if abort" can't open" then ;
+opentestc
+' f< to cc<
+cc1,
+main 42 #eq