test-immutable-struct-constructor.rkt (1817B)
1 #lang typed/racket 2 3 (require delay-pure/private/immutable-struct-constructor 4 "test-immutable-struct-constructor-mod.rkt" 5 typed/rackunit) 6 7 (struct st1 ([a : Number]) #:transparent) 8 9 (struct st2 ([a : Number]) 10 #:constructor-name make-st2 11 #:type-name st2-type 12 #:transparent) 13 14 ;; From this module 15 (check-true (immutable-struct-constructor? st1 (#%variable-reference))) 16 (check-true (immutable-struct-constructor? make-st2 (#%variable-reference))) 17 ;; From another module 18 (check-true (immutable-struct-constructor? st3-mod (#%variable-reference))) 19 (check-true (immutable-struct-constructor? make-st4-mod (#%variable-reference))) 20 21 ;; From a macro 22 (define-syntax (test-from-macro _) 23 #'(begin 24 ;; From this module 25 (check-true (immutable-struct-constructor? st1 26 (#%variable-reference))) 27 (check-true (immutable-struct-constructor? make-st2 28 (#%variable-reference))) 29 ;; From another module 30 (check-true (immutable-struct-constructor? st3-mod 31 (#%variable-reference))) 32 (check-true (immutable-struct-constructor? make-st4-mod 33 (#%variable-reference))))) 34 35 (test-from-macro) 36 37 ;; From a macro, using a module which is required by the macro 38 (define-syntax (test-required-from-macro _) 39 #'(begin 40 (require "test-immutable-struct-constructor-mod2.rkt") 41 ;; From another module 42 (check-true (immutable-struct-constructor? st3-mod 43 (#%variable-reference))) 44 (check-true (immutable-struct-constructor? make-st4-mod 45 (#%variable-reference))))) 46 47 (test-required-from-macro)