You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.1 KiB
Racket
45 lines
1.1 KiB
Racket
9 years ago
|
#lang racket/base
|
||
6 years ago
|
(require (for-syntax
|
||
|
racket/base
|
||
|
racket/syntax
|
||
|
syntax/strip-context)
|
||
|
"define.rkt")
|
||
|
|
||
|
(provide+safe module-test-external
|
||
|
module-test-internal
|
||
|
module-test-internal+external)
|
||
9 years ago
|
|
||
|
;; tests using module-boundary contracts
|
||
|
(define-syntax (module-test-external stx)
|
||
|
(syntax-case stx ()
|
||
6 years ago
|
[(_ EXPR ...)
|
||
|
(replace-context
|
||
|
stx
|
||
|
(with-syntax ([MOD-NAME (syntax-e (generate-temporary))])
|
||
|
#'(begin
|
||
|
(module* MOD-NAME racket/base
|
||
|
(require (submod ".."))
|
||
|
(require rackunit)
|
||
|
EXPR ...)
|
||
|
(module+ test
|
||
|
(require (submod ".." MOD-NAME))))))]))
|
||
9 years ago
|
|
||
|
(define-syntax (module-test-internal stx)
|
||
|
(syntax-case stx ()
|
||
6 years ago
|
[(_ EXPR ...)
|
||
|
(replace-context
|
||
|
stx
|
||
|
#'(begin
|
||
|
(module+ test
|
||
|
(require rackunit)
|
||
|
EXPR ...)))]))
|
||
9 years ago
|
|
||
|
(define-syntax (module-test-internal+external stx)
|
||
|
(syntax-case stx ()
|
||
6 years ago
|
[(_ EXPR ...)
|
||
|
(replace-context
|
||
|
stx
|
||
|
#'(begin
|
||
|
(module-test-internal EXPR ...)
|
||
|
(module-test-external EXPR ...)))]))
|