update for compatibility with new macro expander

pull/2/head
Matthew Butterick 9 years ago
parent ba42aa00e6
commit 23d8a3f821

@ -4,26 +4,28 @@
(define-syntax (eval-as-untyped stx) (define-syntax (eval-as-untyped stx)
(syntax-case stx () (syntax-case stx ()
[(_ exprs ...) [(_ exprs ...)
(with-syntax ([sym (generate-temporary)]) (with-syntax ([sym (syntax-e (generate-temporary))]
#'(begin [sym2 (syntax-e (generate-temporary))])
(module sym racket (datum->syntax stx `(begin
(module ,(syntax->datum #'sym) racket
(require rackunit "main.rkt") (require rackunit "main.rkt")
exprs ...) ,@(syntax->datum #'(exprs ...)))
(require 'sym) (require ',(syntax->datum #'sym))
(module sym2 racket (module ,(syntax->datum #'sym2) racket
(require rackunit (submod "main.rkt" safe)) (require rackunit (submod "main.rkt" safe))
exprs ...) ,@(syntax->datum #'(exprs ...)))
(require 'sym2)))])) (require ',(syntax->datum #'sym2))) stx))]))
(define-syntax (eval-as-typed stx) (define-syntax (eval-as-typed stx)
(syntax-case stx () (syntax-case stx ()
[(_ exprs ...) [(_ exprs ...)
(with-syntax ([sym (generate-temporary)]) (with-syntax ([sym (syntax-e (generate-temporary))])
#'(begin (datum->syntax stx `(begin
(module sym typed/racket (module ,(syntax->datum #'sym) typed/racket
(require typed/rackunit "../typed/txexpr.rkt") (require typed/rackunit "../typed/txexpr.rkt")
exprs ...) ,@(syntax->datum #'(exprs ...)))
(require 'sym)))])) (require ',(syntax->datum #'sym))) stx))]))
(define-syntax-rule (eval-as-typed-and-untyped exprs ...) (define-syntax-rule (eval-as-typed-and-untyped exprs ...)
(begin (begin
@ -32,6 +34,7 @@
(eval-as-typed-and-untyped (eval-as-typed-and-untyped
(require racket/set)
(define-syntax (values->list stx) (define-syntax (values->list stx)
(syntax-case stx () (syntax-case stx ()
[(_ values-expr) #'(call-with-values (λ () values-expr) list)])) [(_ values-expr) #'(call-with-values (λ () values-expr) list)]))
@ -127,7 +130,8 @@
(check-equal? (attrs->hash '((foo "bar")) '(foo "fraw")) '#hash((foo . "fraw"))) (check-equal? (attrs->hash '((foo "bar")) '(foo "fraw")) '#hash((foo . "fraw")))
(check-equal? (attrs->hash '((foo "bar")) '(foo "fraw") 'foo "dog") '#hash((foo . "dog"))) (check-equal? (attrs->hash '((foo "bar")) '(foo "fraw") 'foo "dog") '#hash((foo . "dog")))
(check-equal? (hash->attrs '#hash((foo . "bar")(hee . "haw"))) '((foo "bar")(hee "haw"))) (check-equal? (apply set (hash->attrs '#hash((foo . "bar")(hee . "haw"))))
(apply set '((foo "bar")(hee "haw"))))
(check-equal? (attr-ref '(p ((foo "bar"))) 'foo) "bar") (check-equal? (attr-ref '(p ((foo "bar"))) 'foo) "bar")
(check-equal? (attr-set '(p ((foo "bar"))) 'foo "fraw") '(p ((foo "fraw")))) (check-equal? (attr-set '(p ((foo "bar"))) 'foo "fraw") '(p ((foo "fraw"))))

Loading…
Cancel
Save