From b6fdabcd735f5f5e3abbbcd6ee6c31868ccfbab0 Mon Sep 17 00:00:00 2001 From: Stevie Strickland Date: Sun, 15 Feb 2009 08:31:13 +0000 Subject: [PATCH] Going ahead and adding this test, but need to think about how to attack it. svn: r13602 --- collects/tests/units/test-unit-contracts.ss | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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