diff --git a/collects/tests/units/test-unit-contracts.ss b/collects/tests/units/test-unit-contracts.ss index 6c8c3519b5..b1d0eed3d9 100644 --- a/collects/tests/units/test-unit-contracts.ss +++ b/collects/tests/units/test-unit-contracts.ss @@ -765,3 +765,24 @@ (test-runtime-error exn:fail:contract? "U@ broke contract on x" (f 3)) (invoke-unit W@)) + +(let () + (define-signature foo^ + ((contracted + [x? (-> number? boolean?)] + [f (-> x? number?)]))) + + (define-unit/contract foo@ + (import) + (export (foo^ [x? (-> any/c boolean?)])) + + (define (x? n) (zero? n)) + (define (f x) 3)) + + (define-values/invoke-unit/infer foo@) + + (f 0) + (test-runtime-error exn:fail:contract? "top-level broke the contract on x" + (f 4)) + (test-runtime-error exn:fail:contract? "foo@ broke the contract on x" + (f #t))) \ No newline at end of file