diff --git a/tests/flonum-tests.scm b/tests/flonum-tests.scm index 978099c0..424c381f 100644 --- a/tests/flonum-tests.scm +++ b/tests/flonum-tests.scm @@ -1,6 +1,8 @@ ;;;; these will fail when compiled either without flonums or trig funcs -(import (only (chibi test) test-begin test-assert test test-end)) +(cond-expand + (modules (import (only (chibi test) test-begin test-assert test test-end))) + (else #f)) (test-begin "floating point") diff --git a/tests/hash-tests.scm b/tests/hash-tests.scm index bbfd44eb..d3f20c9c 100644 --- a/tests/hash-tests.scm +++ b/tests/hash-tests.scm @@ -1,5 +1,7 @@ -(import (srfi 69) (only (chibi test) test-begin test test-end)) +(cond-expand + (modules (import (srfi 69) (only (chibi test) test-begin test test-end))) + (else #f)) (test-begin "hash") diff --git a/tests/lib-tests.scm b/tests/lib-tests.scm index 152c2100..80f66d8d 100644 --- a/tests/lib-tests.scm +++ b/tests/lib-tests.scm @@ -1,18 +1,24 @@ -(import (chibi test)) +(cond-expand + (modules (import (chibi test))) + (else (load "tests/r5rs-tests.scm"))) (test-begin "libraries") (load "tests/flonum-tests.scm") (load "tests/numeric-tests.scm") -(load "tests/hash-tests.scm") -(load "tests/sort-tests.scm") (load "tests/loop-tests.scm") (load "tests/match-tests.scm") (load "tests/scribble-tests.scm") -(load "tests/record-tests.scm") -(load "tests/thread-tests.scm") -;;(load "tests/weak-tests.scm") (cond-expand (utf-8 (load "tests/unicode-tests.scm")) (else #f)) +(cond-expand + (modules + (begin + (load "tests/record-tests.scm") + (load "tests/hash-tests.scm") + (load "tests/sort-tests.scm") + (load "tests/thread-tests.scm"))) + (else #f)) + (test-end) diff --git a/tests/loop-tests.scm b/tests/loop-tests.scm index a26205d4..b3f914f1 100644 --- a/tests/loop-tests.scm +++ b/tests/loop-tests.scm @@ -1,5 +1,7 @@ -(import (chibi loop) (only (chibi test) test-begin test test-end)) +(cond-expand + (modules (import (chibi loop) (only (chibi test) test-begin test test-end))) + (else (load "lib/chibi/loop/loop.scm"))) (test-begin "loops") diff --git a/tests/match-tests.scm b/tests/match-tests.scm index a2c054c2..47bf44e7 100644 --- a/tests/match-tests.scm +++ b/tests/match-tests.scm @@ -1,5 +1,7 @@ -(import (chibi match) (only (chibi test) test-begin test test-end)) +(cond-expand + (modules (import (chibi match) (only (chibi test) test-begin test test-end))) + (else (load "lib/chibi/match/match.scm"))) (test-begin "match") diff --git a/tests/numeric-tests.scm b/tests/numeric-tests.scm index 22478044..f221d64e 100644 --- a/tests/numeric-tests.scm +++ b/tests/numeric-tests.scm @@ -2,7 +2,9 @@ ;; these tests are only valid if chibi-scheme is compiled with full ;; numeric support (USE_BIGNUMS, USE_FLONUMS and USE_MATH) -(import (only (chibi test) test-begin test test-end)) +(cond-expand + (modules (import (only (chibi test) test-begin test test-end))) + (else #f)) (test-begin "numbers") diff --git a/tests/r5rs-tests.scm b/tests/r5rs-tests.scm index a9197fb1..41919386 100644 --- a/tests/r5rs-tests.scm +++ b/tests/r5rs-tests.scm @@ -4,6 +4,8 @@ (define-syntax test (syntax-rules () + ((test name expect expr) + (test expect expr)) ((test expect expr) (begin (set! *tests-run* (+ *tests-run* 1)) @@ -26,7 +28,14 @@ (display " expected ") (write expect) (display " but got ") (write res) (newline)))))))) -(define (test-report) +(define-syntax test-assert + (syntax-rules () + ((test-assert expr) (test #t expr)))) + +(define (test-begin . name) + #f) + +(define (test-end) (write *tests-passed*) (display " out of ") (write *tests-run*) @@ -37,6 +46,8 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test-begin "r5rs") + (test 8 ((lambda (x) (+ x x)) 4)) (test '(3 4 5 6) ((lambda x x) 3 4 5 6)) @@ -462,4 +473,4 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(test-report) +(test-end) diff --git a/tests/record-tests.scm b/tests/record-tests.scm index 51f47889..3f842a59 100644 --- a/tests/record-tests.scm +++ b/tests/record-tests.scm @@ -1,6 +1,9 @@ -(import (srfi 99 records syntactic) - (only (chibi test) test-begin test-assert test test-end)) +(cond-expand + (modules + (import (srfi 99 records syntactic) + (only (chibi test) test-begin test-assert test test-end))) + (else #f)) (test-begin "records") diff --git a/tests/scribble-tests.scm b/tests/scribble-tests.scm index 11096bbd..395ba137 100644 --- a/tests/scribble-tests.scm +++ b/tests/scribble-tests.scm @@ -1,5 +1,7 @@ -(import (chibi scribble) (only (chibi test) test-begin test test-end)) +(cond-expand + (modules (import (chibi scribble) (only (chibi test) test-begin test test-end))) + (else (load "lib/chibi/scribble.scm"))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/tests/sort-tests.scm b/tests/sort-tests.scm index 6272f79c..e54162fc 100644 --- a/tests/sort-tests.scm +++ b/tests/sort-tests.scm @@ -1,5 +1,7 @@ -(import (srfi 95) (only (chibi test) test-begin test test-end)) +(cond-expand + (modules (import (srfi 95) (only (chibi test) test-begin test test-end))) + (else #f)) (test-begin "sorting") diff --git a/tests/thread-tests.scm b/tests/thread-tests.scm index af605b17..d40dec7b 100644 --- a/tests/thread-tests.scm +++ b/tests/thread-tests.scm @@ -1,5 +1,7 @@ -(import (srfi 18) (only (chibi test) test-begin test test-end)) +(cond-expand + (modules (import (srfi 18) (only (chibi test) test-begin test test-end))) + (else #f)) (test-begin "threads") diff --git a/tests/unicode-tests.scm b/tests/unicode-tests.scm index a7c08d41..6e88ea93 100644 --- a/tests/unicode-tests.scm +++ b/tests/unicode-tests.scm @@ -1,7 +1,9 @@ ;; These tests are only valid if chibi-scheme is compiled with Unicode ;; support (SEXP_USE_UTF8_STRINGS). -(import (only (chibi test) test-begin test test-end)) +(cond-expand + (modules (import (only (chibi test) test-begin test test-end))) + (else #f)) (test-begin "unicode") @@ -40,7 +42,7 @@ (string-fill! s #\字) s)) -(import (chibi loop)) +(cond-expand (modules (import (chibi loop))) (else #f)) (test "in-string" '(#\日 #\本 #\語)