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.
typesetting/quad/qtest/all.rkt

41 lines
1.5 KiB
Racket

6 years ago
#lang racket
(require quadwriter pitfall/check-pdf racket/runtime-path)
(define-for-syntax (test-pdf-name path)
6 years ago
(path-add-extension (path-replace-extension path #".pdf") #"" #"-tester."))
6 years ago
(define-syntax (make-test-pdf stx)
(syntax-case stx ()
6 years ago
[(_) #'(begin)]
[(_ PATH . REST)
6 years ago
(with-syntax ([PDF-NAME (test-pdf-name (syntax-e #'PATH))])
6 years ago
#'(begin
(parameterize ([quadwriter-test-mode #t])
(render-pdf (dynamic-require PATH 'doc) PDF-NAME))
(make-test-pdf . REST)))]))
6 years ago
6 years ago
(define-syntax (test-each stx)
6 years ago
(syntax-case stx ()
6 years ago
[(_) #'(begin)]
6 years ago
[(_ MOD-PATH . REST)
(with-syntax ([PDF-NAME (test-pdf-name (syntax-e #'MOD-PATH))])
6 years ago
#'(begin
6 years ago
(define-runtime-path path-to-test MOD-PATH)
6 years ago
(define-runtime-path test-base PDF-NAME)
6 years ago
(println MOD-PATH)
(define-runtime-path path (path-replace-extension MOD-PATH #".pdf"))
6 years ago
(check-pdfs-equal? (time (parameterize ([quadwriter-test-mode #t]
[current-output-port (open-output-nowhere)])
6 years ago
(render-pdf (dynamic-require path-to-test 'doc) path)
path)) test-base)
6 years ago
(test-each . REST)))]))
6 years ago
6 years ago
(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"
"test-image.rkt")