summaryrefslogtreecommitdiff
path: root/tests/Hakyll/Web/Page
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Hakyll/Web/Page')
-rw-r--r--tests/Hakyll/Web/Page/Metadata/Tests.hs77
-rw-r--r--tests/Hakyll/Web/Page/Tests.hs40
2 files changed, 0 insertions, 117 deletions
diff --git a/tests/Hakyll/Web/Page/Metadata/Tests.hs b/tests/Hakyll/Web/Page/Metadata/Tests.hs
deleted file mode 100644
index badb9fb..0000000
--- a/tests/Hakyll/Web/Page/Metadata/Tests.hs
+++ /dev/null
@@ -1,77 +0,0 @@
-module Hakyll.Web.Page.Metadata.Tests
- ( tests
- ) where
-
-import Test.Framework
-import Test.HUnit hiding (Test)
-
-import qualified Data.Map as M
-import Data.Monoid (mempty)
-import Data.Char (toLower)
-
-import Hakyll.Web.Page
-import Hakyll.Web.Page.Metadata
-import TestSuite.Util
-
-tests :: [Test]
-tests = concat $
- [ fromAssertions "getField"
- [ "bar" @=? getField "foo" (Page (M.singleton "foo" "bar") "body\n")
- , "" @=? getField "foo" (Page M.empty "body")
- ]
-
- , fromAssertions "getFieldMaybe"
- [ Just "bar" @=? getFieldMaybe "foo" (Page (M.singleton "foo" "bar") "")
- , Nothing @=? getFieldMaybe "foo" (Page M.empty "body")
- ]
-
- , fromAssertions "setField"
- [ (Page (M.singleton "bar" "foo") "") @=? setField "bar" "foo" mempty
- , (Page (M.singleton "bar" "foo") "") @=?
- setField "bar" "foo" (Page (M.singleton "bar" "qux") "")
- ]
-
- , fromAssertions "trySetField"
- [ (Page (M.singleton "bar" "foo") "") @=? trySetField "bar" "foo" mempty
- , (Page (M.singleton "bar" "qux") "") @=?
- trySetField "bar" "foo" (Page (M.singleton "bar" "qux") "")
- ]
-
- , fromAssertions "setFieldA"
- [ (Page (M.singleton "bar" "foo") "") @=?
- setFieldA "bar" (map toLower) (mempty, "FOO")
- ]
-
- , fromAssertions "renderDateField"
- [ (@=?) "January 31, 2010" $ getField "date" $ renderDateField
- "date" "%B %e, %Y" "Date unknown" $ Page
- (M.singleton "path" "/posts/2010-01-31-a-post.mkdwn") ""
- , (@=?) "Date unknown" $ getField "date" $ renderDateField
- "date" "%B %e, %Y" "Date unknown" $ Page
- (M.singleton "path" "/posts/a-post.mkdwn") ""
- , (@=?) "February 20, 2000" $ getField "date" $ renderDateField
- "date" "%B %e, %Y" "Date unknown" $ flip Page "" $ M.fromList
- [ ("path", "/posts/2010-01-31-a-post.mkdwn")
- , ("published", "February 20, 2000 1:00 PM")
- ]
- , (@=?) "October 22, 2012" $ getField "date" $ renderDateField
- "date" "%B %e, %Y" "Date unknown" $ Page
- (M.singleton "date" "2012-10-22 14:35:24") ""
- ]
-
- , fromAssertions "copyBodyToField"
- [ (Page (M.singleton "bar" "foo") "foo") @=?
- copyBodyToField "bar" (Page M.empty "foo")
- ]
-
- , fromAssertions "copyBodyFromField"
- [ (Page (M.singleton "bar" "foo") "foo") @=?
- copyBodyFromField "bar" (Page (M.singleton "bar" "foo") "qux")
- ]
-
- , fromAssertions "comparePagesByDate"
- [ GT @=? comparePagesByDate
- (Page (M.singleton "path" "/posts/1990-08-26-foo.mkdwn") "")
- (Page (M.singleton "path" "/posts/1990-06-18-qux.mkdwn") "")
- ]
- ]
diff --git a/tests/Hakyll/Web/Page/Tests.hs b/tests/Hakyll/Web/Page/Tests.hs
deleted file mode 100644
index 8e01302..0000000
--- a/tests/Hakyll/Web/Page/Tests.hs
+++ /dev/null
@@ -1,40 +0,0 @@
-{-# LANGUAGE OverloadedStrings #-}
-module Hakyll.Web.Page.Tests
- ( tests
- ) where
-
-import Test.Framework
-import Test.HUnit hiding (Test)
-
-import qualified Data.Map as M
-
-import Hakyll.Web.Page
-import Hakyll.Web.Page.Read
-import TestSuite.Util
-
-tests :: [Test]
-tests = fromAssertions "readPage"
- [ Page (M.singleton "foo" "bar") "body" @=? readPage
- "--- \n\
- \foo: bar \n\
- \--- \n\
- \body"
-
- , Page M.empty "line one\nlijn twee" @=? readPage
- "line one\n\
- \lijn twee"
-
- , Page (M.fromList [("field1", "unos"), ("veld02", "deux")]) "" @=? readPage
- "---\n\
- \veld02: deux\n\
- \field1: unos\n\
- \---\n"
-
- , Page (M.fromList [("author", "jasper"), ("title", "lol")]) "O hai\n"
- @=? readPage
- "---\n\
- \author: jasper\n\
- \title: lol\n\
- \...\n\
- \O hai\n"
- ]