summaryrefslogtreecommitdiff
path: root/tests/Hakyll
diff options
context:
space:
mode:
authorAlexey Kreshchuk <akrsch@gmail.com>2013-10-18 01:23:14 +0400
committerAlexey Kreshchuk <akrsch@gmail.com>2013-10-18 01:23:14 +0400
commit46b6f78da8ed814bef6972f4712d8b13e76c1122 (patch)
treee8f0c803a4ea2e8af17289b36bf97177d531ba7f /tests/Hakyll
parent712ffa39b5857fdc5cdae1db38a177267a430b11 (diff)
downloadhakyll-46b6f78da8ed814bef6972f4712d8b13e76c1122.tar.gz
Added test case for global metadata
Diffstat (limited to 'tests/Hakyll')
-rw-r--r--tests/Hakyll/Core/Provider/GlobalMetadata/Tests.hs31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/Hakyll/Core/Provider/GlobalMetadata/Tests.hs b/tests/Hakyll/Core/Provider/GlobalMetadata/Tests.hs
new file mode 100644
index 0000000..289e2ac
--- /dev/null
+++ b/tests/Hakyll/Core/Provider/GlobalMetadata/Tests.hs
@@ -0,0 +1,31 @@
+--------------------------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+module Hakyll.Core.Provider.GlobalMetadata.Tests
+ ( tests
+ ) where
+
+--------------------------------------------------------------------------------
+import qualified Data.Map as M
+import Control.Monad (forM_)
+import Test.Framework (Test, testGroup)
+import Test.HUnit (Assertion, (@=?))
+
+
+--------------------------------------------------------------------------------
+import Hakyll.Core.Provider (resourceMetadata)
+import TestSuite.Util
+
+--------------------------------------------------------------------------------
+tests :: Test
+tests = testGroup "Hakyll.Core.Provider.GlobalMetadata.Tests" $
+ fromAssertions "page" [testPage]
+
+testPage :: Assertion
+testPage = do
+ store <- newTestStore
+ provider <- newTestProvider store
+
+ metadata <- resourceMetadata provider "posts/2013-10-18-metadata-test.md"
+ forM_ ["1", "2", "3", "4", "5", "6", "7", "8"] $ \a ->
+ Just a @=? M.lookup ('a':a) metadata
+