on cd24697 help sign in
hakyll/tests/File.hs
62 lines 2.3 kB history raw
1module File
2 ( fileGroup
3 ) where
5import qualified Data.Map as M
7import Control.Applicative ((<$>))
8import Data.Binary
9import Test.Framework (testGroup)
10import Test.Framework.Providers.HUnit
11import Test.Framework.Providers.QuickCheck2
12import Test.HUnit
13import Test.QuickCheck
15import Text.Hakyll (runDefaultHakyll)
16import Text.Hakyll.File
18-- File test group.
19fileGroup = testGroup "File"
20 [ testCase "test_toRoot_1" test_toRoot_1
21 , testCase "test_toRoot_2" test_toRoot_2
22 , testCase "test_toRoot_3" test_toRoot_3
23 , testCase "test_inHakyllDirectory_1" test_inHakyllDirectory_1
24 , testCase "test_inHakyllDirectory_2" test_inHakyllDirectory_2
25 , testCase "test_inHakyllDirectory_3" test_inHakyllDirectory_3
26 , testCase "test_inHakyllDirectory_4" test_inHakyllDirectory_4
27 , testCase "test_removeSpaces_1" test_removeSpaces_1
28 , testCase "test_removeSpaces_2" test_removeSpaces_2
29 , testCase "test_havingExtension_1" test_havingExtension_1
30 , testCase "test_havingExtension_2" test_havingExtension_2
31 ]
34-- toRoot test cases
35test_toRoot_1 = toRoot "/posts/foo.html" @?= ".."
36test_toRoot_2 = toRoot "posts/foo.html" @?= ".."
37test_toRoot_3 = toRoot "foo.html" @?= "."
39-- inHakyllDirectory test cases
40test_inHakyllDirectory_1 =
41 (runDefaultHakyll $ inHakyllDirectory "_site/foo.html")
42 @? "test_inHakyllDirectory_1"
43test_inHakyllDirectory_2 =
44 (not <$> (runDefaultHakyll $ inHakyllDirectory "posts/foo.html"))
45 @? "test_inHakyllDirectory_2"
46test_inHakyllDirectory_3 =
47 (not <$> (runDefaultHakyll $ inHakyllDirectory "index.html"))
48 @? "test_inHakyllDirectory_3"
49test_inHakyllDirectory_4 =
50 (runDefaultHakyll $ inHakyllDirectory "_cache/index.html")
51 @? "test_inHakyllDirectory_4"
53-- removeSpaces test cases
54test_removeSpaces_1 = removeSpaces "$root/tags/random crap.html"
55 @?= "$root/tags/random-crap.html"
56test_removeSpaces_2 = removeSpaces "another simple example.zip"
57 @?= "another-simple-example.zip"
59-- Having extension test cases
60test_havingExtension_1 = havingExtension ".foo" ["file.bar", "file.txt"] @?= []
61test_havingExtension_2 = havingExtension ".foo" ["file.foo", "file.txt"]
62 @?= ["file.foo"]