+ (test-f equal? str output)))
+
+(define-syntax test-exception
+ (syntax-rules ()
+ ((_ f)
+ (begin
+ (display (quote f))
+ (newline)
+ (call/cc (lambda (k)
+ (with-exception-handler
+ (lambda (x)
+ (when (eqv? 'no-exception x)
+ (error #f "test failed: no exception thrown"))
+ (k))
+ (lambda ()
+ (begin
+ f
+ (raise 'no-exception))))))))))
+
+(test (data-tors '(A . ((foo Int Bool)
+ (bar Bool))))
+ '((foo (A foo constructor)
+ abs Int (abs Bool A))
+ (foo~0 (A foo 0) abs A Int)
+ (foo~1 (A foo 1) abs A Bool)
+ (bar (A bar constructor) abs Bool A)
+ (bar~0 (A bar 0) abs A Bool)))
+
+(test (data-tors-type-env
+ '(A . ((foo Int Bool)
+ (bar Bool))))
+ '((foo . (abs Int (abs Bool A)))
+ (foo~0 . (abs A Int))
+ (foo~1 . (abs A Bool))
+ (bar . (abs Bool A))
+ (bar~0 . (abs A Bool))))