@@ -4,6 +4,7 @@ module File
5import qualified Data.Map as M
5import qualified Data.Map as M
7+import Control.Applicative ((<$>))
7import Data.Binary
8import Data.Binary
8import Test.Framework (testGroup)
9import Test.Framework (testGroup)
9import Test.Framework.Providers.HUnit
10import Test.Framework.Providers.HUnit
@@ -11,6 +12,7 @@ import Test.Framework.Providers.QuickCheck2
11import Test.HUnit
12import Test.HUnit
12import Test.QuickCheck
13import Test.QuickCheck
15+import Text.Hakyll (runDefaultHakyll)
14import Text.Hakyll.File
16import Text.Hakyll.File
16-- File test group.
18-- File test group.
@@ -18,6 +20,10 @@ fileGroup = testGroup "File"
18 [ testCase "test_toRoot_1" test_toRoot_1
20 [ testCase "test_toRoot_1" test_toRoot_1
19 , testCase "test_toRoot_2" test_toRoot_2
21 , testCase "test_toRoot_2" test_toRoot_2
20 , testCase "test_toRoot_3" test_toRoot_3
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
21 , testCase "test_removeSpaces_1" test_removeSpaces_1
27 , testCase "test_removeSpaces_1" test_removeSpaces_1
22 , testCase "test_removeSpaces_2" test_removeSpaces_2
28 , testCase "test_removeSpaces_2" test_removeSpaces_2
23 , testCase "test_havingExtension_1" test_havingExtension_1
29 , testCase "test_havingExtension_1" test_havingExtension_1
@@ -30,6 +36,20 @@ test_toRoot_1 = toRoot "/posts/foo.html" @?= ".."
30test_toRoot_2 = toRoot "posts/foo.html" @?= ".."
36test_toRoot_2 = toRoot "posts/foo.html" @?= ".."
31test_toRoot_3 = toRoot "foo.html" @?= "."
37test_toRoot_3 = toRoot "foo.html" @?= "."
39+-- inHakyllDirectory test cases
40+test_inHakyllDirectory_1 =
41+ (runDefaultHakyll $ inHakyllDirectory "_site/foo.html")
42+ @? "test_inHakyllDirectory_1"
43+test_inHakyllDirectory_2 =
44+ (not <$> (runDefaultHakyll $ inHakyllDirectory "posts/foo.html"))
45+ @? "test_inHakyllDirectory_2"
46+test_inHakyllDirectory_3 =
47+ (not <$> (runDefaultHakyll $ inHakyllDirectory "index.html"))
48+ @? "test_inHakyllDirectory_3"
49+test_inHakyllDirectory_4 =
50+ (runDefaultHakyll $ inHakyllDirectory "_cache/index.html")
51+ @? "test_inHakyllDirectory_4"
33-- removeSpaces test cases
53-- removeSpaces test cases
34test_removeSpaces_1 = removeSpaces "$root/tags/random crap.html"
54test_removeSpaces_1 = removeSpaces "$root/tags/random crap.html"
35 @?= "$root/tags/random-crap.html"
55 @?= "$root/tags/random-crap.html"