aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorCalvin Rose <calsrose@gmail.com>2021-10-23 00:09:48 -0500
committerGitHub <noreply@github.com>2021-10-23 00:09:48 -0500
commitb491eeb963d89d35b06e7728f98bc269d5e50551 (patch)
treed6747ff184e2fa3efe31efeb67256b2657f305fe /test
parentMerge pull request #50 from elimisteve/patch-1 (diff)
parentAdd discrete test for each of the chunk type (diff)
Merge pull request #49 from pepe/discrete-test
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)