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.
55 lines
1.9 KiB
Racket
55 lines
1.9 KiB
Racket
9 years ago
|
#lang at-exp racket/base
|
||
10 years ago
|
(require rackunit racket/port racket/system racket/runtime-path compiler/find-exe)
|
||
11 years ago
|
|
||
|
(module test-default pollen
|
||
|
"hello world")
|
||
|
(require (prefix-in default: 'test-default))
|
||
|
(check-equal? default:doc "hello world")
|
||
|
|
||
|
|
||
|
(module test-pre pollen/pre
|
||
|
"hello world")
|
||
|
(require (prefix-in pre: 'test-pre))
|
||
|
(check-equal? pre:doc "hello world")
|
||
|
|
||
|
|
||
|
(module test-markup pollen/markup
|
||
|
"hello world")
|
||
|
(require (prefix-in markup: 'test-markup))
|
||
|
(check-equal? markup:doc '(root "hello world"))
|
||
10 years ago
|
|
||
11 years ago
|
|
||
|
(module test-markdown pollen/markdown
|
||
|
"hello world")
|
||
|
(require (prefix-in markdown: 'test-markdown))
|
||
|
(check-equal? markdown:doc '(root (p () "hello world")))
|
||
|
|
||
|
|
||
|
(module test-ptree pollen/ptree
|
||
|
'(index (brother sister)))
|
||
|
(require (prefix-in ptree: 'test-ptree))
|
||
|
(check-equal? ptree:doc '(pagetree-root (index (brother sister))))
|
||
|
|
||
10 years ago
|
|
||
10 years ago
|
;; define-runtime-path only allowed at top level
|
||
9 years ago
|
(define-runtime-path test.ptree "data/test.ptree")
|
||
|
(define-runtime-path test.html.pm "data/test.html.pm")
|
||
|
(define-runtime-path test-import.html.pm "data/test-import.html.pm")
|
||
|
(define-runtime-path test.html.pmd "data/test.html.pmd")
|
||
|
(define-runtime-path test.html.pp "data/test.html.pp")
|
||
|
(define-runtime-path test.no-ext "data/test.no-ext")
|
||
10 years ago
|
|
||
|
|
||
|
;; `find-exe` avoids reliance on $PATH of the host system
|
||
|
(define racket-path (find-exe))
|
||
|
(when racket-path
|
||
|
(define (run path)
|
||
9 years ago
|
(define cmd-string (format "'~a' ~a" racket-path path))
|
||
10 years ago
|
(with-output-to-string (λ() (system cmd-string))))
|
||
|
(check-equal? (run test.ptree) "'(pagetree-root test ====)")
|
||
9 years ago
|
(check-equal? (run test.html.pm) @string-append{'(root "test" "\n" "====")})
|
||
|
(check-equal? (run test-import.html.pm) @string-append{'(root "test" "\n" "====" "\n" (root "This is sample 01."))})
|
||
10 years ago
|
(check-equal? (run test.html.pmd) "'(root (h1 ((id \"test\")) \"test\"))")
|
||
|
(check-equal? (run test.html.pp) "test\n====")
|
||
|
(check-equal? (run test.no-ext) "test\n===="))
|