From 652ceb03f1185ad8d41e7a3b91f00e1064bdd4ba Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Wed, 16 Jan 2013 10:50:01 +0100 Subject: Add applyJoinTemplateList, and a test for it --- tests/Hakyll/Web/Template/Tests.hs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/Hakyll/Web/Template/Tests.hs b/tests/Hakyll/Web/Template/Tests.hs index fce5503..6fb5233 100644 --- a/tests/Hakyll/Web/Template/Tests.hs +++ b/tests/Hakyll/Web/Template/Tests.hs @@ -9,7 +9,7 @@ module Hakyll.Web.Template.Tests import Data.Monoid (mconcat) import Test.Framework (Test, testGroup) import Test.Framework.Providers.HUnit (testCase) -import Test.HUnit (Assertion, (@=?)) +import Test.HUnit (Assertion, (@=?), (@?=)) -------------------------------------------------------------------------------- @@ -18,13 +18,16 @@ import Hakyll.Core.Provider import Hakyll.Web.Pandoc import Hakyll.Web.Template import Hakyll.Web.Template.Context +import Hakyll.Web.Template.Internal +import Hakyll.Web.Template.List import TestSuite.Util -------------------------------------------------------------------------------- tests :: Test tests = testGroup "Hakyll.Core.Template.Tests" - [ testCase "case01" case01 + [ testCase "case01" case01 + , testCase "applyJoinTemplateList" testApplyJoinTemplateList ] @@ -49,3 +52,18 @@ testContext = mconcat [ functionField "echo" (\args _ -> return $ unwords args) , defaultContext ] + + +-------------------------------------------------------------------------------- +testApplyJoinTemplateList :: Assertion +testApplyJoinTemplateList = do + store <- newTestStore + provider <- newTestProvider store + str <- testCompilerDone store provider "item3" $ + applyJoinTemplateList ", " tpl defaultContext [i1, i2] + + str @?= "Hello, World" + where + i1 = Item "item1" "Hello" + i2 = Item "item2" "World" + tpl = Template [Chunk "", Key "body", Chunk ""] -- cgit v1.2.3