summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorsamgd <sam@samgd.com>2016-07-24 17:30:47 +0200
committersamgd <sam@samgd.com>2016-07-24 17:30:47 +0200
commit43c969f326082d29d8e340ee865414deb87b8ac5 (patch)
tree4730aa3988de5f21505e989702d076ce9a51fc0a /tests
parentca7b78ee428a43bb307ecefb65529d5106751192 (diff)
downloadhakyll-43c969f326082d29d8e340ee865414deb87b8ac5.tar.gz
Fix module layout
Diffstat (limited to 'tests')
-rw-r--r--tests/Hakyll/Web/Template/Tests.hs87
1 files changed, 39 insertions, 48 deletions
diff --git a/tests/Hakyll/Web/Template/Tests.hs b/tests/Hakyll/Web/Template/Tests.hs
index 087e0cb..54d5406 100644
--- a/tests/Hakyll/Web/Template/Tests.hs
+++ b/tests/Hakyll/Web/Template/Tests.hs
@@ -31,57 +31,48 @@ tests = testGroup "Hakyll.Core.Template.Tests" $ concat
]
, fromAssertions "readTemplate"
- [ Template [Chunk "Hello ", Expr (Call "guest" [])]
- @=? readTemplate "Hello $guest()$"
- , Template
- [If (Call "a" [StringLiteral "bar"])
- (Template [Chunk "foo"])
- Nothing]
- @=? readTemplate "$if(a(\"bar\"))$foo$endif$"
+ [ [Chunk "Hello ", Expr (Call "guest" [])]
+ @=? readTemplateElems "Hello $guest()$"
+ , [If (Call "a" [StringLiteral "bar"]) [Chunk "foo"] Nothing]
+ @=? readTemplateElems "$if(a(\"bar\"))$foo$endif$"
-- 'If' trim check.
- , Template
- [ TrimL
- , If (Ident (TemplateKey "body"))
- (Template [ TrimR
- , Chunk "\n"
- , Expr (Ident (TemplateKey "body"))
- , Chunk "\n"
- , TrimL
- ])
- (Just (Template [ TrimR
- , Chunk "\n"
- , Expr (Ident (TemplateKey "body"))
- , Chunk "\n"
- , TrimL
- ]))
- , TrimR
- ]
- @=? readTemplate "$-if(body)-$\n$body$\n$-else-$\n$body$\n$-endif-$"
+ , [ TrimL
+ , If (Ident (TemplateKey "body"))
+ [ TrimR
+ , Chunk "\n"
+ , Expr (Ident (TemplateKey "body"))
+ , Chunk "\n"
+ , TrimL
+ ]
+ (Just [ TrimR
+ , Chunk "\n"
+ , Expr (Ident (TemplateKey "body"))
+ , Chunk "\n"
+ , TrimL
+ ])
+ , TrimR
+ ]
+ @=? readTemplateElems "$-if(body)-$\n$body$\n$-else-$\n$body$\n$-endif-$"
-- 'For' trim check.
- , Template
- [ TrimL
- , For (Ident (TemplateKey "authors"))
- (Template [ TrimR
- , Chunk "\n body \n"
- , TrimL])
- Nothing
- , TrimR
- ]
- @=? readTemplate "$-for(authors)-$\n body \n$-endfor-$"
+ , [ TrimL
+ , For (Ident (TemplateKey "authors"))
+ [TrimR, Chunk "\n body \n", TrimL]
+ Nothing
+ , TrimR
+ ]
+ @=? readTemplateElems "$-for(authors)-$\n body \n$-endfor-$"
-- 'Partial' trim check.
- , Template
- [ TrimL
- , Partial (StringLiteral "path")
- , TrimR
- ]
- @=? readTemplate "$-partial(\"path\")-$"
+ , [ TrimL
+ , Partial (StringLiteral "path")
+ , TrimR
+ ]
+ @=? readTemplateElems "$-partial(\"path\")-$"
-- 'Expr' trim check.
- , Template
- [ TrimL
- , Expr (Ident (TemplateKey "foo"))
- , TrimR
- ]
- @=? readTemplate "$-foo-$"
+ , [ TrimL
+ , Expr (Ident (TemplateKey "foo"))
+ , TrimR
+ ]
+ @=? readTemplateElems "$-foo-$"
]
]
@@ -126,4 +117,4 @@ testApplyJoinTemplateList = do
where
i1 = Item "item1" "Hello"
i2 = Item "item2" "World"
- tpl = Template [Chunk "<b>", Expr (Ident "body"), Chunk "</b>"]
+ tpl = readTemplate "<b>$body$</b>"