Add a test for renderDateField
This commit is contained in:
parent
d1c0ad7c25
commit
d7e9b2f2d7
2 changed files with 12 additions and 3 deletions
|
@ -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'.
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue