test suite

main
Matthew Butterick 6 years ago
parent ea48d8f881
commit dd59145cf9

@ -2,18 +2,22 @@
(require quadwriter pitfall/check-pdf racket/runtime-path)
(define-for-syntax (test-pdf-name path)
(path-add-extension (path-replace-extension path #".pdf") #"" #" tester."))
(path-add-extension (path-replace-extension path #".pdf") #"" #"-tester."))
(define-syntax (make-test-pdf stx)
(syntax-case stx ()
[(_ PATH)
[(_) #'(begin)]
[(_ PATH . REST)
(with-syntax ([PDF-NAME (test-pdf-name (syntax-e #'PATH))])
#'(parameterize ([quadwriter-test-mode #t])
(render-pdf (dynamic-require PATH 'doc) PDF-NAME)))]))
#'(begin
(parameterize ([quadwriter-test-mode #t])
(render-pdf (dynamic-require PATH 'doc) PDF-NAME))
(make-test-pdf . REST)))]))
(define-syntax (test-one stx)
(define-syntax (test-each stx)
(syntax-case stx ()
[(_ PATH)
[(_) #'(begin)]
[(_ PATH . REST)
(with-syntax ([PDF-NAME (test-pdf-name (syntax-e #'PATH))])
#'(begin
(define-runtime-path path-to-test PATH)
@ -21,12 +25,13 @@
(println PATH)
(check-pdfs-equal? (time (parameterize ([quadwriter-test-mode #t]
[current-output-port (open-output-nowhere)])
(render-pdf (dynamic-require path-to-test 'doc) #f))) test-base)))]))
(define-syntax-rule (test-each PATH ...)
(begin (test-one PATH) ...))
(test-each "hello.rkt"
"hello.rkt"
"hello.rkt")
(render-pdf (dynamic-require path-to-test 'doc) #f))) test-base)
(test-each . REST)))]))
(test-each "test-docs.rkt"
"test-emoji.rkt"
"test-fallback-mini.rkt"
"test-fallback-super.rkt"
"test-hello.rkt"
"test-kafka.rkt"
"test-symbol.rkt")

Loading…
Cancel
Save