summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Hakyll/Web/Page/Tests.hs35
-rw-r--r--tests/TestSuite.hs3
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/Hakyll/Web/Page/Tests.hs b/tests/Hakyll/Web/Page/Tests.hs
new file mode 100644
index 0000000..14f3d7e
--- /dev/null
+++ b/tests/Hakyll/Web/Page/Tests.hs
@@ -0,0 +1,35 @@
+{-# LANGUAGE OverloadedStrings #-}
+module Hakyll.Web.Page.Tests
+ ( tests
+ ) where
+
+import Test.Framework
+import Test.Framework.Providers.HUnit
+import Test.HUnit hiding (Test)
+
+import qualified Data.Map as M
+
+import Hakyll.Web.Page
+import Hakyll.Web.Page.Internal
+import Hakyll.Web.Page.Read
+import TestSuite.Util
+
+tests :: [Test]
+tests = fromAssertions "applyTemplate"
+ -- Hakyll templates
+ [ Page (M.singleton "foo" "bar") "body\n" @=? readPage
+ "--- \n\
+ \foo: bar \n\
+ \--- \n\
+ \body"
+
+ , Page M.empty "line one\nlijn twee\n" @=? readPage
+ "line one\n\
+ \lijn twee"
+
+ , Page (M.fromList [("field1", "unos"), ("veld02", "deux")]) "" @=? readPage
+ "---\n\
+ \veld02: deux\n\
+ \field1: unos\n\
+ \---"
+ ]
diff --git a/tests/TestSuite.hs b/tests/TestSuite.hs
index aaf4481..5d401d2 100644
--- a/tests/TestSuite.hs
+++ b/tests/TestSuite.hs
@@ -5,6 +5,7 @@ import Test.Framework (defaultMain, testGroup)
import qualified Hakyll.Core.DirectedGraph.Tests
import qualified Hakyll.Core.Identifier.Tests
import qualified Hakyll.Core.Routes.Tests
+import qualified Hakyll.Web.Page.Tests
import qualified Hakyll.Web.Template.Tests
main :: IO ()
@@ -15,6 +16,8 @@ main = defaultMain
Hakyll.Core.Identifier.Tests.tests
, testGroup "Hakyll.Core.Routes.Tests"
Hakyll.Core.Routes.Tests.tests
+ , testGroup "Hakyll.Web.Page.Tests"
+ Hakyll.Web.Page.Tests.tests
, testGroup "Hakyll.Web.Template.Tests"
Hakyll.Web.Template.Tests.tests
]