update test infra

main
Matthew Butterick 5 years ago
parent 75b3b0939c
commit cc7a64c5ee

@ -0,0 +1,15 @@
#lang racket
(require quadwriter
pitfall/check-pdf
racket/runtime-path
"paths-to-test.rkt")
(for ([test-path (in-list (test-paths))])
(define pdf-path (path-replace-extension test-path #".pdf"))
(define-values (dir name _) (split-path test-path))
(displayln (path->string name))
(check-pdfs-equal? (time (parameterize ([quadwriter-test-mode #t]
[current-output-port (open-output-nowhere)])
(render-pdf (dynamic-require test-path 'doc) pdf-path test-path)
pdf-path))
(test-pdf-name test-path)))

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

@ -0,0 +1,14 @@
#lang racket/base
(require racket/runtime-path)
(provide (all-defined-out))
(define-runtime-path here ".")
(define (test-paths)
(for/list ([test-path (in-directory here)]
#:when (regexp-match #rx"test-.*.rkt$" (path->string test-path)))
test-path))
(define (test-pdf-name path)
(path-add-extension (path-replace-extension path #".pdf") #"" #"-tester."))

@ -8,7 +8,8 @@
(λ ()
(match (with-handlers ([exn:fail? (λ (exn) #f)])
(vector-ref (current-command-line-arguments) 0))
["test" (dynamic-require 'qtest/all #f)]
["test" (dynamic-require 'qtest/all-tests #f)]
["update" (dynamic-require 'qtest/update-tests #f)]
[_ (displayln "no cmd given")]))
#:logger qtest-logger
'info

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,9 @@
#lang racket/base
(require quadwriter
"paths-to-test.rkt")
(for ([test-path (in-list (test-paths))])
(define-values (dir name _) (split-path test-path))
(displayln (path->string name))
(time (parameterize ([quadwriter-test-mode #t])
(render-pdf (dynamic-require test-path 'doc) (test-pdf-name test-path) test-path))))
Loading…
Cancel
Save