[racket-dev] [plt] Push #29458: master branch updated

From: Stephen Chang (stchang at ccs.neu.edu)
Date: Wed Oct 29 16:40:36 EDT 2014

Reviewing the git logs, it looks like I made a mistake (according to
commit b192620b0d1c26773167c6afa14ceb6303588591), and that it's
actually the docs that are wrong. Sorry. Fixing it now.

On Wed, Oct 29, 2014 at 4:33 PM,  <stchang at racket-lang.org> wrote:
> stchang has updated `master' from 3d2fdbc8cf to 40422d35d3.
>   http://git.racket-lang.org/plt/3d2fdbc8cf..40422d35d3
>
> =====[ One Commit ]=====================================================
> Directory summary:
>   93.4% pkgs/racket-pkgs/racket-test/tests/racket/
>    6.5% racket/collects/racket/
>
> ~~~~~~~~~~
>
> 40422d3 Stephen Chang <stchang at racket-lang.org> 2014-10-29 16:31
> :
> | change set/c default #:kind to dont-care, to match docs
> |
> | - add set/c tests
> :
>   M racket/collects/racket/set.rkt                    |  2 +-
>   M .../racket-pkgs/racket-test/tests/racket/set.rktl | 29 ++++++++++++++++++++
>
> =====[ Overall Diff ]===================================================
>
> pkgs/racket-pkgs/racket-test/tests/racket/set.rktl
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> --- OLD/pkgs/racket-pkgs/racket-test/tests/racket/set.rktl
> +++ NEW/pkgs/racket-pkgs/racket-test/tests/racket/set.rktl
> @@ -561,6 +561,7 @@
>                         (add1 i)))
>
>  ;; ----------------------------------------
> +;; set/c tests
>
>  (err/rt-test (set/c '(not a contract)))
>  (err/rt-test (set/c any/c #:cmp 'not-a-comparison))
> @@ -568,4 +569,32 @@
>  (err/rt-test (set/c (-> integer? string?) #:cmp 'eq))
>  (err/rt-test (set/c (-> integer? string?) #:cmp 'eqv))
>
> +(define (app-ctc ctc value)
> +  (contract ctc value 'positive 'negative))
> +
> +(define (positive-error? exn)
> +  (and exn:fail:contract?
> +       (regexp-match? "blaming: positive" (exn-message exn))))
> +(define (negative-error? exn)
> +  (and exn:fail:contract?
> +       (regexp-match? "blaming: negative" (exn-message exn))))
> +
> +(define-syntax-rule (test/blame-pos e)
> +  (thunk-error-test (lambda () e) #'e positive-error?))
> +(define-syntax-rule (test/blame-neg e)
> +  (thunk-error-test (lambda () e) #'e negative-error?))
> +
> +;; check dont-care defaults
> +(test #t set? (app-ctc (set/c any/c) (set)))
> +(test #t set-mutable? (app-ctc (set/c any/c) (mutable-set)))
> +(test #t set? (app-ctc (set/c any/c) (seteq)))
> +(test #t set-mutable? (app-ctc (set/c any/c) (mutable-seteqv)))
> +
> +(test/blame-pos (app-ctc (set/c any/c #:cmp 'eq) (set)))
> +(test/blame-pos (app-ctc (set/c any/c #:kind 'mutable) (set)))
> +(test/blame-pos (app-ctc (set/c string? #:kind 'immutable) (set 1)))
> +(test #t set? (app-ctc (set/c string?) (set 1))) ; ok bc we get a ho contract
> +(test/blame-pos (set-first (app-ctc (set/c string?) (set 1))))
> +(test/blame-neg (set-add! (app-ctc (set/c string?) (mutable-set)) 1))
> +
>  (report-errs)
>
> racket/collects/racket/set.rkt
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> --- OLD/racket/collects/racket/set.rkt
> +++ NEW/racket/collects/racket/set.rkt
> @@ -12,7 +12,7 @@
>
>  (define (set/c elem/c
>                 #:cmp [cmp 'dont-care]
> -               #:kind [kind 'immutable])
> +               #:kind [kind 'dont-care])
>    (define cmp/c
>      (case cmp
>        [(dont-care) any/c]

Posted on the dev mailing list.