]> gitweb.factorcode.org Git - factor.git/blob - basis/html/templates/fhtml/fhtml-tests.factor
factor: rename [ ] [ ] unit-test -> { } [ ] unit-test using a refactoring tool!
[factor.git] / basis / html / templates / fhtml / fhtml-tests.factor
1 USING: io io.files io.streams.string io.encodings.utf8
2 html.templates html.templates.fhtml kernel
3 tools.test sequences parser splitting prettyprint ;
4 IN: html.templates.fhtml.tests
5
6 : test-template ( path -- ? )
7     "vocab:html/templates/fhtml/test/"
8     prepend
9     [ ".fhtml" append <fhtml> [ call-template ] with-string-writer ]
10     [ ".html" append utf8 file-contents ] bi
11     [ . . ] [ = ] 2bi ;
12
13 { t } [ "example" test-template ] unit-test
14 { t } [ "bug" test-template ] unit-test
15 { t } [ "stack" test-template ] unit-test
16
17 [
18     [ ] [ "<%\n%>" parse-template drop ] unit-test
19 ] with-file-vocabs
20
21 [
22     [ ] [
23         """<%
24             IN: html.templates.fhtml.tests
25             : test-word ( -- ) ;
26             %>""" parse-template drop
27     ] unit-test
28 ] with-file-vocabs