on master help sign in
Add a test for renderDateField
d7e9b2fJasper Van der Jeugt
src/Hakyll/Web/Feed.hs+3−3
@@ -7,11 +7,11 @@
7-- Also note that the pages should have (at least) the following fields to
7-- Also note that the pages should have (at least) the following fields to
8-- produce a correct feed:
8-- produce a correct feed:
9--
9--
10−-- - @$title@: Title of the item
10+-- - @$title$@: Title of the item
11--
11--
12−-- - @$description@: Description to appear in the feed
12+-- - @$description$@: Description to appear in the feed
13--
13--
14−-- - @$url@: URL to the item - this is usually set automatically.
14+-- - @$url$@: URL to the item - this is usually set automatically.
15--
15--
16-- In addition, the posts should be named according to the rules for
16-- In addition, the posts should be named according to the rules for
17-- 'Hakyll.Page.Metadata.renderDateField'.
17-- 'Hakyll.Page.Metadata.renderDateField'.
tests/Hakyll/Web/Page/Metadata/Tests.hs+9
@@ -42,6 +42,15 @@ tests = concat $
42 setFieldA "bar" (map toLower) (mempty, "FOO")
42 setFieldA "bar" (map toLower) (mempty, "FOO")
43 ]
43 ]
44
44
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+
45 , fromAssertions "copyBodyToField"
54 , fromAssertions "copyBodyToField"
46 [ (Page (M.singleton "bar" "foo") "foo") @=?
55 [ (Page (M.singleton "bar" "foo") "foo") @=?
47 copyBodyToField "bar" (Page M.empty "foo")
56 copyBodyToField "bar" (Page M.empty "foo")