on master help sign in
Add a test for renderDateField
commitd7e9b2f2d71231ecbe761e57ca0023bd266fa566 authorJasper Van der Jeugt <m@jaspervdj.be> dateTue 31 Jan 2012, 15:27 (15 years ago) parentd1c0ad7
2 files changed+12−3
src/Hakyll/Web/Feed.hs+3−3 tests/Hakyll/Web/Page/Metadata/Tests.hs+9
src/Hakyll/Web/Feed.hs+3−3
@@ -7,11 +7,11 @@
77-- Also note that the pages should have (at least) the following fields to
88-- produce a correct feed:
99--
10−-- - @$title@: Title of the item
10+-- - @$title$@: Title of the item
1111--
12−-- - @$description@: Description to appear in the feed
12+-- - @$description$@: Description to appear in the feed
1313--
14−-- - @$url@: URL to the item - this is usually set automatically.
14+-- - @$url$@: URL to the item - this is usually set automatically.
1515--
1616-- In addition, the posts should be named according to the rules for
1717-- 'Hakyll.Page.Metadata.renderDateField'.
tests/Hakyll/Web/Page/Metadata/Tests.hs+9
@@ -42,6 +42,15 @@ tests = concat $
4242 setFieldA "bar" (map toLower) (mempty, "FOO")
4343 ]
4444
45+ , fromAssertions "renderDateField"
46+ [ (@=?) "January 31, 2010" $ getField "date" $ renderDateField
47+ "date" "%B %e, %Y" "Date unknown" $ Page
48+ (M.singleton "path" "/posts/2010-01-31-a-post.mkdwn") ""
49+ , (@=?) "Date unknown" $ getField "date" $ renderDateField
50+ "date" "%B %e, %Y" "Date unknown" $ Page
51+ (M.singleton "path" "/posts/a-post.mkdwn") ""
52+ ]
53+
4554 , fromAssertions "copyBodyToField"
4655 [ (Page (M.singleton "bar" "foo") "foo") @=?
4756 copyBodyToField "bar" (Page M.empty "foo")