summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2012-01-31 15:27:03 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2012-01-31 15:27:03 +0100
commitd7e9b2f2d71231ecbe761e57ca0023bd266fa566 (patch)
tree17bbab5048f0aafdd99bbbcd8b29a534870e2a3b
parentd1c0ad7c25427980bee482db31678f9ac4958c1c (diff)
downloadhakyll-d7e9b2f2d71231ecbe761e57ca0023bd266fa566.tar.gz
Add a test for renderDateField
-rw-r--r--src/Hakyll/Web/Feed.hs6
-rw-r--r--tests/Hakyll/Web/Page/Metadata/Tests.hs9
2 files changed, 12 insertions, 3 deletions
diff --git a/src/Hakyll/Web/Feed.hs b/src/Hakyll/Web/Feed.hs
index 77c97d3..f64bb55 100644
--- a/src/Hakyll/Web/Feed.hs
+++ b/src/Hakyll/Web/Feed.hs
@@ -7,11 +7,11 @@
-- Also note that the pages should have (at least) the following fields to
-- produce a correct feed:
--
--- - @$title@: Title of the item
+-- - @$title$@: Title of the item
--
--- - @$description@: Description to appear in the feed
+-- - @$description$@: Description to appear in the feed
--
--- - @$url@: URL to the item - this is usually set automatically.
+-- - @$url$@: URL to the item - this is usually set automatically.
--
-- In addition, the posts should be named according to the rules for
-- 'Hakyll.Page.Metadata.renderDateField'.
diff --git a/tests/Hakyll/Web/Page/Metadata/Tests.hs b/tests/Hakyll/Web/Page/Metadata/Tests.hs
index 6fbd89a..f14bfec 100644
--- a/tests/Hakyll/Web/Page/Metadata/Tests.hs
+++ b/tests/Hakyll/Web/Page/Metadata/Tests.hs
@@ -42,6 +42,15 @@ tests = concat $
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") ""
+ ]
+
, fromAssertions "copyBodyToField"
[ (Page (M.singleton "bar" "foo") "foo") @=?
copyBodyToField "bar" (Page M.empty "foo")