|
|
|
@ -1,27 +1,27 @@
|
|
|
|
|
#lang racket/base
|
|
|
|
|
(require (for-syntax racket/base racket/syntax))
|
|
|
|
|
(require (for-syntax racket/base racket/syntax syntax/strip-context))
|
|
|
|
|
|
|
|
|
|
;; use a separate test file to avoid cycle in loading
|
|
|
|
|
(define-syntax (test-safe-and-unsafe stx)
|
|
|
|
|
(syntax-case stx ()
|
|
|
|
|
[(_ exprs ...)
|
|
|
|
|
(with-syntax ([sym (syntax-e (generate-temporary))]
|
|
|
|
|
[sym2 (syntax-e (generate-temporary))])
|
|
|
|
|
(datum->syntax stx `(begin
|
|
|
|
|
(module ,(syntax->datum #'sym) racket
|
|
|
|
|
(with-syntax ([module-without-contracts (generate-temporary)]
|
|
|
|
|
[module-with-contracts (generate-temporary)])
|
|
|
|
|
(replace-context stx #'(begin
|
|
|
|
|
(module module-without-contracts racket
|
|
|
|
|
(require rackunit "main.rkt")
|
|
|
|
|
(define-syntax (values->list stx)
|
|
|
|
|
(syntax-case stx ()
|
|
|
|
|
[(_ values-expr) #'(call-with-values (λ () values-expr) list)]))
|
|
|
|
|
,@(syntax->datum #'(exprs ...)))
|
|
|
|
|
(require ',(syntax->datum #'sym))
|
|
|
|
|
(module ,(syntax->datum #'sym2) racket
|
|
|
|
|
exprs ...)
|
|
|
|
|
(require 'module-without-contracts)
|
|
|
|
|
(module module-with-contracts racket
|
|
|
|
|
(require rackunit (submod "main.rkt" safe))
|
|
|
|
|
(define-syntax (values->list stx)
|
|
|
|
|
(syntax-case stx ()
|
|
|
|
|
[(_ values-expr) #'(call-with-values (λ () values-expr) list)]))
|
|
|
|
|
,@(syntax->datum #'(exprs ...)))
|
|
|
|
|
(require ',(syntax->datum #'sym2))) stx))]))
|
|
|
|
|
exprs ...)
|
|
|
|
|
(require 'module-with-contracts))))]))
|
|
|
|
|
|
|
|
|
|
(test-safe-and-unsafe
|
|
|
|
|
|
|
|
|
|