racket/collects/tests/racket/shared.rktl
Matthew Flatt 655f6045a2 fix shared' for #:auto' fields and constructors without `make-'
Closes PR 11588
 Closes PR 11591
2011-01-05 13:52:11 -07:00

35 lines
821 B
Racket

(load-relative "loadtest.rktl")
(Section 'shared)
(require mzlib/shared)
(require (only-in mzscheme define-struct))
(load-relative "shared-tests.rktl")
(stest (letrec ([x x]) x) (shared ([x x]) x))
(stest (letrec ([x x]) x) (shared ([x y][y x]) x))
(namespace-require/copy 'scheme/base)
(require (only-in mzscheme define-struct))
(load-relative "shared-tests.rktl")
;; Check that `shared' works with `struct':
(let ()
(struct a (x y) #:mutable #:transparent)
(define an-a (a 1 2))
(set-a-y! an-a an-a)
(test an-a 'an-a (shared ([t (a 1 t)])
t)))
;; Check that `shared' works with auto fields:
(let ()
(struct a (x y [z #:auto]) #:mutable #:transparent)
(define an-a (a 1 2))
(set-a-y! an-a an-a)
(test an-a 'an-a (shared ([t (a 1 t)])
t)))
(report-errs)