aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorJosef Pospíšil <josef.pospisil@laststar.eu>2021-10-18 13:52:01 +0200
committerJosef Pospíšil <josef.pospisil@laststar.eu>2021-10-18 13:52:01 +0200
commita421e531e217b5b9e2b8d94958756e38ba0ddd5e (patch)
treedbe0b46fb07e6abb99b62216ccbfd821af26f81f /test
parentMerge pull request #45 from pepe/fix-reading-req (diff)
Add discrete test for each of the chunk type
Diffstat (limited to 'test')
-rw-r--r--test/suite0008.janet19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/suite0008.janet b/test/suite0008.janet
index 2cdb843..edcb1ee 100644
--- a/test/suite0008.janet
+++ b/test/suite0008.janet
@@ -39,4 +39,23 @@
(def expected "<html>hello world</html>")
(test/assert (= expected (string out)) "Rendered temple string produces \"hello world\"")
+(def ctc
+ `{$ (import /spork/fmt) $}{{ (fmt/format (string "(def c " (args :a) " )")) }}`)
+
+(test/assert (deep= ((temple/compile ctc) :a "a > b")
+ @"(def c a &gt; b)\n")
+ "compile time chunk")
+
+(test/assert (deep= ((temple/compile `{{ (args :a) }}`) :a "a > b")
+ @"a &gt; b")
+ "sub chunk")
+
+(test/assert (deep= ((temple/compile `{% (print (args :a)) %}`) :a "a > b")
+ @"a > b\n")
+ "code chunk")
+
+(test/assert (deep= ((temple/compile `{- (args :a) -}`) :a "a > b")
+ @"a > b")
+ "raw chunk")
+
(test/end-suite)