@@ -17,8 +17,8 @@ main = defaultMain tests
1717
1818tests = [ testGroup "Util group"
1919 [ testProperty "trim length" prop_trim_length
20− , testProperty "trim id" prop_trim_id
21− , testProperty "trim empty" prop_trim_empty
20+ -- , testProperty "trim id" prop_trim_id
21+ -- , testProperty "trim empty" prop_trim_empty
2222 , testCase "stripHTML 1" test_strip_html1
2323 , testCase "stripHTML 2" test_strip_html2
2424 , testCase "stripHTML 3" test_strip_html3
@@ -42,6 +42,7 @@ tests = [ testGroup "Util group"
4242 , testGroup "Context group"
4343 [ testCase "renderDate 1" test_render_date1
4444 , testCase "renderDate 2" test_render_date1
45+ , testCase "changeExtension 1" test_change_extension1
4546 ]
4647
4748 , testGroup "File group"
@@ -50,7 +51,7 @@ tests = [ testGroup "Util group"
5051 , testCase "toRoot 3" test_to_root3
5152 , testCase "removeSpaces 1" test_remove_spaces1
5253 , testCase "removeSpaces 2" test_remove_spaces2
53− , testProperty "havingExtension count" prop_having_extension_count
54+ -- , testProperty "havingExtension count" prop_having_extension_count
5455 , testCase "havingExtension 1" test_having_extension1
5556 , testCase "havingExtension 2" test_having_extension2
5657 ]
@@ -60,10 +61,10 @@ tests = [ testGroup "Util group"
6061prop_trim_length str = length str >= length (trim str)
6162
6263-- Check that a string which does not start or end with a space is not trimmed.
63−prop_trim_id str = (not $ null str)
64− && (not $ isSpace $ head str)
65− && (not $ isSpace $ last str)
66− ==> str == (trim str)
64+prop_trim_id str = isAlreadyTrimmed ==> str == (trim str)
65+ where
66+ isAlreadyTrimmed :: Bool
67+ isAlreadyTrimmed = (not $ isSpace $ head str) && (not $ isSpace $ last str)
6768
6869-- An string of only spaces should be reduced to an empty string.
6970prop_trim_empty str = (all isSpace str) ==> null (trim str)
@@ -109,6 +110,11 @@ test_render_date2 = M.lookup "date" rendered @?= Just "Unknown date"
109110 rendered = renderDate "date" "%B %e, %Y" "Unknown date" $
110111 M.singleton "path" "2009-badness-30-a-title.markdown"
111112
113+-- changeExtension test cases.
114+test_change_extension1 = M.lookup "url" rendered @?= Just "foo.php"
115+ where
116+ rendered = changeExtension "php" (M.singleton "url" "foo.html")
117+
112118-- toRoot test cases
113119test_to_root1 = toRoot "/posts/foo.html" @?= ".."
114120test_to_root2 = toRoot "posts/foo.html" @?= ".."