most tests can now be run without modules enabled

This commit is contained in:
Alex Shinn 2011-04-26 23:19:23 +09:00
parent 0ad4d2ff63
commit 052de70a20
12 changed files with 58 additions and 20 deletions

View file

@ -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")

View file

@ -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")

View file

@ -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)

View file

@ -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")

View file

@ -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")

View file

@ -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")

View file

@ -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)

View file

@ -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")

View file

@ -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")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

@ -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")

View file

@ -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")

View file

@ -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"
'(#\日 #\本 #\語)