more flexible test

dev-poly-fix-201114
Matthew Butterick 4 years ago
parent 8a8e497bfe
commit e434406b46

@ -1 +1 @@
1603075171
1603077405

@ -1,5 +1,5 @@
#lang at-exp racket/base
(require rackunit racket/runtime-path pollen/render racket/file racket/system pollen/setup)
(require rackunit racket/runtime-path pollen/render racket/file racket/system pollen/setup txexpr xml)
;; define-runtime-path only allowed at top level
(define-runtime-path poly-output-path-dir "data/poly-output-path")
@ -14,16 +14,17 @@
[current-project-root poly-output-path-dir])
(for ([parallel? (list #true #false)])
;; passing "text.txt" as argument should force use of `txt` rendering
(render-batch #:parallel parallel? test.txt)
(check-equal? (file->string test.txt) "(root hello world)")
(delete-file test.txt)
(check-false (file-exists? test.html))
;; passing poly source as argument should result in default (html) rendering
(render-batch #:parallel parallel? test.poly.pm)
(check-equal? (file->string test.html) "<html><head><meta charset=\"UTF-8\"/></head><body><root>hello world</root></body></html>")
(delete-file test.html)
(check-false (file-exists? test.txt))))
;; passing "text.txt" as argument should force use of `txt` rendering
(render-batch #:parallel parallel? test.txt)
(check-equal? (file->string test.txt) "(root hello world)")
(delete-file test.txt)
(check-false (file-exists? test.html))
;; passing poly source as argument should result in default (html) rendering
(render-batch #:parallel parallel? test.poly.pm)
(check-txexprs-equal?
(string->xexpr (file->string test.html))
(string->xexpr "<html><head><meta charset=\"UTF-8\"/></head><body><root>hello world</root></body></html>"))
(delete-file test.html)
(check-false (file-exists? test.txt))))
(delete-directory/files pollen-cache)
Loading…
Cancel
Save