consolidate untyped tests

pull/3/head
Matthew Butterick 9 years ago
parent fa148d6055
commit 2737fff0b4

@ -4,22 +4,17 @@
(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 (generate-temporary)]
[sym2 (generate-temporary)])
#'(begin #'(begin
(module sym racket (module sym racket
(require rackunit "../main.rkt" net/url) (require rackunit "../main.rkt" net/url)
exprs ...) exprs ...)
(require 'sym)))])) (require 'sym)
(module sym2 racket
(define-syntax (eval-as-untyped-safe stx)
(syntax-case stx ()
[(_ exprs ...)
(with-syntax ([sym (generate-temporary)])
#'(begin
(module sym racket
(require rackunit (submod "../main.rkt" safe) net/url) (require rackunit (submod "../main.rkt" safe) net/url)
exprs ...) exprs ...)
(require 'sym)))])) (require 'sym2)))]))
(define-syntax (eval-as-typed stx) (define-syntax (eval-as-typed stx)
(syntax-case stx () (syntax-case stx ()
@ -34,7 +29,6 @@
(define-syntax-rule (eval-as-typed-and-untyped exprs ...) (define-syntax-rule (eval-as-typed-and-untyped exprs ...)
(begin (begin
(eval-as-untyped exprs ...) (eval-as-untyped exprs ...)
(eval-as-untyped-safe exprs ...)
(eval-as-typed exprs ...))) (eval-as-typed exprs ...)))
@ -179,8 +173,8 @@
(check-equal? (map (λ(a b c) (list a b c)) (shift xs -1) (shift xs 0) (shift xs 1)) '((1 0 #f) (2 1 0) (3 2 1) (4 3 2) (#f 4 3))) (check-equal? (map (λ(a b c) (list a b c)) (shift xs -1) (shift xs 0) (shift xs 1)) '((1 0 #f) (2 1 0) (3 2 1) (4 3 2) (#f 4 3)))
(check-equal? (map (λ(a b c) (list a b c)) (shift xs -1 'ignored #t) (shift xs 0 'ignored #t) (shift xs 1 'ignored #t)) '((1 0 4) (2 1 0) (3 2 1) (4 3 2) (0 4 3))) (check-equal? (map (λ(a b c) (list a b c)) (shift xs -1 'ignored #t) (shift xs 0 'ignored #t) (shift xs 1 'ignored #t)) '((1 0 4) (2 1 0) (3 2 1) (4 3 2) (0 4 3)))
(check-equal? (shifts xs '(-1 0 1) 'boing) `((1 2 3 4 boing) ,xs (boing 0 1 2 3))) (check-equal? (shifts xs '(-1 0 1) 'boing) `((1 2 3 4 boing) ,xs (boing 0 1 2 3)))
(check-equal? (shifts xs '(-1 0 1) 'boing #t) `((1 2 3 4 0) ,xs (4 0 1 2 3))) (check-equal? (shifts xs '(-1 0 1) 'boing #t) `((1 2 3 4 0) ,xs (4 0 1 2 3)))
(check-equal? (shift xs 5 0) (make-list 5 0)) (check-equal? (shift xs 5 0) (make-list 5 0))
(check-exn exn:fail? (λ() (shift xs -10)))) (check-exn exn:fail? (λ() (shift xs -10))))

Loading…
Cancel
Save