add runtime paths

pull/58/head
Matthew Butterick 10 years ago
parent 8045e5ff6f
commit d01e40e380

@ -1,5 +1,5 @@
#lang racket/base #lang racket/base
(require rackunit racket/port racket/system) (require rackunit racket/port racket/system racket/runtime-path)
(module test-default pollen (module test-default pollen
@ -31,13 +31,16 @@
(require (prefix-in ptree: 'test-ptree)) (require (prefix-in ptree: 'test-ptree))
(check-equal? ptree:doc '(pagetree-root (index (brother sister)))) (check-equal? ptree:doc '(pagetree-root (index (brother sister))))
(define (run path)
(define (run file) (with-output-to-string (λ() (system (format "racket ~a" path)))))
(with-output-to-string (λ() (system (format "racket ~a" file)))))
(define-runtime-path test.ptree "test.ptree")
(module+ main (check-equal? (run test.ptree) "'(pagetree-root test ====)")
(check-equal? (run "test.ptree") "'(pagetree-root test ====)") (define-runtime-path test.html.pm "test.html.pm")
(check-equal? (run "test.html.pm") "'(root \"test\" \"\\n\" \"====\")") (check-equal? (run "test.html.pm") "'(root \"test\" \"\\n\" \"====\")")
(check-equal? (run "test.html.pmd") "'(root (h1 ((id \"test\")) \"test\"))") (define-runtime-path test.html.pmd "test.html.pmd")
(check-equal? (run "test.html.pp") "test\n====") (check-equal? (run "test.html.pmd") "'(root (h1 ((id \"test\")) \"test\"))")
(check-equal? (run "test.no-ext") "test\n====")) (define-runtime-path test.html.pp "test.html.pp")
(check-equal? (run "test.html.pp") "test\n====")
(define-runtime-path test.no-ext "test.no-ext")
(check-equal? (run "test.no-ext") "test\n====")

@ -1,11 +1,12 @@
#lang racket/base #lang racket/base
(require rackunit) (require rackunit racket/runtime-path)
(require "../render.rkt") (require "../render.rkt")
(require/expose "../render.rkt" (modification-date-hash make-mod-dates-key path->mod-date-value store-render-in-modification-dates modification-date-expired?)) (require/expose "../render.rkt" (modification-date-hash make-mod-dates-key path->mod-date-value store-render-in-modification-dates modification-date-expired?))
(check-pred hash? modification-date-hash) (check-pred hash? modification-date-hash)
(define sample-dir (string->path "samples")) (define-runtime-path sample-dir "samples")
(define samples (parameterize ([current-directory sample-dir]) (define samples (parameterize ([current-directory sample-dir])
(map path->complete-path (directory-list ".")))) (map path->complete-path (directory-list "."))))
(define-values (sample-01 sample-02 sample-03) (apply values samples)) (define-values (sample-01 sample-02 sample-03) (apply values samples))

Loading…
Cancel
Save