Index: tests/run.scm =================================================================== --- tests/run.scm (revision 28181) +++ tests/run.scm (working copy) @@ -1,12 +1,18 @@ ;;;; run.scm - run tests for typed-records.scm -(use setup-api) +(use setup-api test) -(run (csi -s t.scm)) +(test-group "interpreted" + (run (csi -s t.scm))) -(compile -s -specialize t.scm) -(load "t.so") +(when (version>=? (chicken-version) "4.7.5") + (test-group "compiled with specialization" + (compile -s -specialize t.scm) + (load "t.so"))) -(compile -s t.scm -o t2.so) -(load "t2.so") +(test-group "compiled without specialization" + (compile -s t.scm -o t2.so) + (load "t2.so")) + +(test-exit) Index: tests/t.scm =================================================================== --- tests/t.scm (revision 28181) +++ tests/t.scm (working copy) @@ -1,9 +1,8 @@ ;;;; t.scm - tests for typed-records.scm -(use typed-records) +(use typed-records type-stubs test) - (define-record point x (y : number)) @@ -29,8 +28,11 @@ ((_ t x) (cond-expand (compiling - (compiler-typecase x - (t 'ok))) + (test 'ok + (compiler-typecase x + (t 'ok) + (* 'wrong) + (else 'ok)))) (else #f))))) (let ((pt (make-point 1 2)) @@ -47,8 +49,9 @@ (let ((p (make-person age: 33))) #+compiling (compiler-typecase (person-age p) - (fixnum 'ok)) - (assert (= 33 (person-age p)))) + (fixnum 'ok) + (else 'wrong)) + (test-assert (= 33 (person-age p)))) ) @@ -77,5 +80,5 @@ (define x (create-bar943 1)) -(assert (eq? 1 (bar943-a x))) -(assert (eq? 42 (bar943-b x))) +(test-assert (eq? 1 (bar943-a x))) +(test-assert (eq? 42 (bar943-b x))) Index: typed-records.meta =================================================================== --- typed-records.meta (revision 28181) +++ typed-records.meta (working copy) @@ -4,7 +4,8 @@ (category misc) (license "BSD") (doc-from-wiki) - (depends defstruct (chicken "4.7.5")) + (depends defstruct type-stubs) + (test-depends test) (author "felix winkelmann") (files "typed-records.scm" "typed-records.meta" "typed-records.setup" "tests/run.scm")) Index: typed-records.scm =================================================================== --- typed-records.scm (revision 28181) +++ typed-records.scm (working copy) @@ -9,7 +9,8 @@ (rename chicken (define-record-type define-record-type1) (define-record define-record1)) - (rename defstruct (defstruct defstruct1))) + (rename defstruct (defstruct defstruct1)) + type-stubs) (import-for-syntax srfi-1 chicken)