@@ -4,6 +4,7 @@ module File
44
55import qualified Data.Map as M
66
7+import Control.Applicative ((<$>))
78import Data.Binary
89import Test.Framework (testGroup)
910import Test.Framework.Providers.HUnit
@@ -11,6 +12,7 @@ import Test.Framework.Providers.QuickCheck2
1112import Test.HUnit
1213import Test.QuickCheck
1314
15+import Text.Hakyll (runDefaultHakyll)
1416import Text.Hakyll.File
1517
1618-- File test group.
@@ -18,6 +20,10 @@ fileGroup = testGroup "File"
1820 [ testCase "test_toRoot_1" test_toRoot_1
1921 , testCase "test_toRoot_2" test_toRoot_2
2022 , 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
2127 , testCase "test_removeSpaces_1" test_removeSpaces_1
2228 , testCase "test_removeSpaces_2" test_removeSpaces_2
2329 , testCase "test_havingExtension_1" test_havingExtension_1
@@ -30,6 +36,20 @@ test_toRoot_1 = toRoot "/posts/foo.html" @?= ".."
3036test_toRoot_2 = toRoot "posts/foo.html" @?= ".."
3137test_toRoot_3 = toRoot "foo.html" @?= "."
3238
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"
52+
3353-- removeSpaces test cases
3454test_removeSpaces_1 = removeSpaces "$root/tags/random crap.html"
3555 @?= "$root/tags/random-crap.html"