|
|
@ -1,7 +1,8 @@
|
|
|
|
#lang racket/base
|
|
|
|
#lang racket/base
|
|
|
|
(require (for-syntax racket/base racket/syntax))
|
|
|
|
(require (for-syntax racket/base racket/syntax))
|
|
|
|
|
|
|
|
|
|
|
|
(define-syntax (eval-as-untyped stx)
|
|
|
|
;; use a separate test file to avoid cycle in loading
|
|
|
|
|
|
|
|
(define-syntax (test-safe-and-unsafe stx)
|
|
|
|
(syntax-case stx ()
|
|
|
|
(syntax-case stx ()
|
|
|
|
[(_ exprs ...)
|
|
|
|
[(_ exprs ...)
|
|
|
|
(with-syntax ([sym (syntax-e (generate-temporary))]
|
|
|
|
(with-syntax ([sym (syntax-e (generate-temporary))]
|
|
|
@ -9,17 +10,21 @@
|
|
|
|
(datum->syntax stx `(begin
|
|
|
|
(datum->syntax stx `(begin
|
|
|
|
(module ,(syntax->datum #'sym) racket
|
|
|
|
(module ,(syntax->datum #'sym) racket
|
|
|
|
(require rackunit "main.rkt")
|
|
|
|
(require rackunit "main.rkt")
|
|
|
|
|
|
|
|
(define-syntax (values->list stx)
|
|
|
|
|
|
|
|
(syntax-case stx ()
|
|
|
|
|
|
|
|
[(_ values-expr) #'(call-with-values (λ () values-expr) list)]))
|
|
|
|
,@(syntax->datum #'(exprs ...)))
|
|
|
|
,@(syntax->datum #'(exprs ...)))
|
|
|
|
(require ',(syntax->datum #'sym))
|
|
|
|
(require ',(syntax->datum #'sym))
|
|
|
|
(module ,(syntax->datum #'sym2) racket
|
|
|
|
(module ,(syntax->datum #'sym2) racket
|
|
|
|
(require rackunit (submod "main.rkt" safe))
|
|
|
|
(require rackunit (submod "main.rkt" safe))
|
|
|
|
,@(syntax->datum #'(exprs ...)))
|
|
|
|
|
|
|
|
(require ',(syntax->datum #'sym2))) stx))]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(eval-as-untyped
|
|
|
|
|
|
|
|
(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)]))
|
|
|
|
|
|
|
|
,@(syntax->datum #'(exprs ...)))
|
|
|
|
|
|
|
|
(require ',(syntax->datum #'sym2))) stx))]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(test-safe-and-unsafe
|
|
|
|
|
|
|
|
|
|
|
|
(check-true (txexpr-tag? 'foo))
|
|
|
|
(check-true (txexpr-tag? 'foo))
|
|
|
|
(check-false (txexpr-tag? "foo"))
|
|
|
|
(check-false (txexpr-tag? "foo"))
|
|
|
|
(check-false (txexpr-tag? 3))
|
|
|
|
(check-false (txexpr-tag? 3))
|
|
|
@ -115,11 +120,11 @@
|
|
|
|
(check-equal? (->txexpr-attr-value "foo") "foo")
|
|
|
|
(check-equal? (->txexpr-attr-value "foo") "foo")
|
|
|
|
(check-equal? (->txexpr-attr-value 'foo) "foo")
|
|
|
|
(check-equal? (->txexpr-attr-value 'foo) "foo")
|
|
|
|
|
|
|
|
|
|
|
|
(check-equal? (attrs->hash '((foo "bar"))) '#hash((foo . "bar")))
|
|
|
|
(check-equal? (attrs->hash '((foo "bar"))) '#hasheq((foo . "bar")))
|
|
|
|
(check-equal? (attrs->hash '((foo "bar")) '(foo "fraw")) '#hash((foo . "fraw")))
|
|
|
|
(check-equal? (attrs->hash '((foo "bar")) '(foo "fraw")) '#hasheq((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") '#hasheq((foo . "dog")))
|
|
|
|
|
|
|
|
|
|
|
|
(check-equal? (apply set (hash->attrs '#hash((foo . "bar")(hee . "haw"))))
|
|
|
|
(check-equal? (apply set (hash->attrs '#hasheq((foo . "bar")(hee . "haw"))))
|
|
|
|
(apply set '((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")
|
|
|
|