Skip to content
Browse files

Add a test for renderDateField

  • Loading branch information...
1 parent e08e629 commit 5ffdc4742dab015057e85c24be24ca182863068b @jaspervdj jaspervdj committed with Jan 31, 2012
Showing with 12 additions and 3 deletions.
  1. +3 −3 src/Hakyll/Web/Feed.hs
  2. +9 −0 tests/Hakyll/Web/Page/Metadata/Tests.hs
View
6 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'.
View
9 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")

0 comments on commit 5ffdc47

Please sign in to comment.
Something went wrong with that request. Please try again.