8import Test.Framework (testGroup)
9import Test.Framework.Providers.HUnit
10import Test.Framework.Providers.QuickCheck2
13import Text.Hakyll.Util
16utilGroup = testGroup "Util"
17 [ testProperty "prop_trim_length" prop_trim_length
18 , testProperty "prop_trim_id" prop_trim_id
19 , testProperty "prop_stripHtml_length" prop_stripHtml_length
20 , testProperty "prop_stripHtml_id" prop_stripHtml_id
21 , testCase "test_stripHtml_1" test_stripHtml_1
22 , testCase "test_stripHtml_2" test_stripHtml_2
23 , testCase "test_stripHtml_3" test_stripHtml_3
24 , testCase "test_link_1" test_link_1
25 , testCase "test_link_2" test_link_2
28-- Test that a string always becomes shorter when trimmed.
29prop_trim_length str = length str >= length (trim str)
31-- Check that a string which does not start or end with a space is not trimmed.
32prop_trim_id str = (not $ null str) && isAlreadyTrimmed ==> str == (trim str)
34 isAlreadyTrimmed :: Bool
35 isAlreadyTrimmed = (not $ isSpace $ head str) && (not $ isSpace $ last str)
37-- Check that a stripped string is shorter.
38prop_stripHtml_length str = length str >= length (stripHtml str)
40-- Check that strings without tags remain untouched.
41prop_stripHtml_id str = (not $ any (`elem` ['>', '<']) str)
42 ==> str == stripHtml str
44-- Strip Html test cases.
45test_stripHtml_1 = stripHtml "<b>text</b>" @?= "text"
46test_stripHtml_2 = stripHtml "text" @?= "text"
48 stripHtml "<b>Hakyll</b>, a <i>website</i> generator<img src=\"foo.png\" />"
49 @?= "Hakyll, a website generator"
52test_link_1 = link "foo bar" "/foo/bar.html"
53 @?= "<a href=\"/foo/bar.html\">foo bar</a>"
54test_link_2 = link "back home" "/" @?= "<a href=\"/\">back home</a>"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list