diff --git a/collects/tests/unstable/contract.rkt b/collects/tests/unstable/contract.rkt index 4175c673bc..82ab3fc790 100644 --- a/collects/tests/unstable/contract.rkt +++ b/collects/tests/unstable/contract.rkt @@ -38,31 +38,31 @@ (in-dict (list (cons 1 'one) (cons 2 'two))))]) (void))))) (test-suite "Data structure contracts" - (test-suite "option/c" - (test-true "flat" (flat-contract? (option/c number?))) - (test-true "chaperone" (chaperone-contract? (option/c (box/c number?)))) - (test-true "impersonator" (impersonator-contract? (option/c (object/c)))) - (test-ok (with/c (option/c number?) 0)) - (test-ok (with/c (option/c number?) #f)) - (test-ok (with/c (option/c (-> number? number?)) #f)) - (test-ok (with/c (option/c (-> number? number?)) +)) - (test-ok (with/c (option/c (class/c (field [x number?]))) + (test-suite "maybe/c" + (test-true "flat" (flat-contract? (maybe/c number?))) + (test-true "chaperone" (chaperone-contract? (maybe/c (box/c number?)))) + (test-true "impersonator" (impersonator-contract? (maybe/c (object/c)))) + (test-ok (with/c (maybe/c number?) 0)) + (test-ok (with/c (maybe/c number?) #f)) + (test-ok (with/c (maybe/c (-> number? number?)) #f)) + (test-ok (with/c (maybe/c (-> number? number?)) +)) + (test-ok (with/c (maybe/c (class/c (field [x number?]))) (class object% (super-new) (field [x 0])))) - (test-ok (with/c (option/c (class/c (field [x number?]))) #f)) - (test-ok (with/c (class/c (field [c (option/c string?)])) + (test-ok (with/c (maybe/c (class/c (field [x number?]))) #f)) + (test-ok (with/c (class/c (field [c (maybe/c string?)])) (class object% (super-new) (field [c #f])))) - (test-bad (with/c (option/c number?) "string")) - (test-bad (with/c (option/c (-> number? number?)) + (test-bad (with/c (maybe/c number?) "string")) + (test-bad (with/c (maybe/c (-> number? number?)) (lambda (x y) x))) (test-bad - ([with/c (option/c (-> number? number?)) + ([with/c (maybe/c (-> number? number?)) (lambda (x) (void))] 0)) - (test-bad (with/c (option/c (class/c (field [x number?]))) + (test-bad (with/c (maybe/c (class/c (field [x number?]))) (class object% (super-new)))) - (test-bad (with/c (option/c (class/c (field [x number?]))) 5)) + (test-bad (with/c (maybe/c (class/c (field [x number?]))) 5)) (test-bad - (get-field c (with/c (class/c (field [c (option/c string?)])) + (get-field c (with/c (class/c (field [c (maybe/c string?)])) (class object% (super-new) (field [c 70]))))))))) diff --git a/collects/unstable/scribblings/contract.scrbl b/collects/unstable/scribblings/contract.scrbl index 024ae2ca64..9fd76850cc 100644 --- a/collects/unstable/scribblings/contract.scrbl +++ b/collects/unstable/scribblings/contract.scrbl @@ -72,7 +72,7 @@ flat contract. @addition{Asumu Takikawa} -@defproc[(option/c [contract contract?]) contract?]{ +@defproc[(maybe/c [contract contract?]) contract?]{ Creates a contract that acts like @racket[contract] but will also accept @racket[#f]. Intended to describe situations where a failure