make optional-test and diff-test run without (chibi test)

Tested with gauche. It's mostly about not importing (chibi test)
unconditionally, and importing (scheme write). And in one case I need to
exclude some tests because gauche catches invalid call forms at compile
time. I'm not sure if that can be caught...
This commit is contained in:
Nguyễn Thái Ngọc Duy 2020-09-01 20:50:01 +07:00
parent e5cf364360
commit 65a1eba878
2 changed files with 13 additions and 6 deletions

View file

@ -1,10 +1,11 @@
(define-library (chibi diff-test)
(import (scheme base) (chibi diff) (chibi test))
(import (scheme base) (chibi diff))
(export run-tests)
(cond-expand
(chibi (import (chibi test)))
(else
(import (scheme write))
;; inline (chibi test) to avoid circular dependencies in snow
;; installations
(begin

View file

@ -1,9 +1,10 @@
(define-library (chibi optional-test)
(import (scheme base) (chibi optional) (chibi test))
(import (scheme base) (chibi optional))
(cond-expand
(chibi (import (chibi test)))
(else
(import (scheme write))
;; inline (chibi test) to avoid circular dependencies in snow
;; installations
(begin
@ -52,13 +53,18 @@
(test '(0 1 (2 3 4))
(let-optionals '(0 1 2 3 4) ((a 10) (b 11) . c)
(list a b c)))
(test-error '(0 11 12)
(cond-expand
(gauche) ; gauche detects this at compile-time, can't catch
(else (test-error '(0 11 12)
((opt-lambda (a (b 11) (c 12))
(list a b c))))
(list a b c))))))
(let ()
(define-opt (f a (b 11) (c 12))
(list a b c))
(test-error (f))
(cond-expand
(gauche)
(else
(test-error (f))))
(test '(0 11 12) (f 0))
(test '(0 1 12) (f 0 1))
(test '(0 1 2) (f 0 1 2))