diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-08-02 12:59:22 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-08-02 12:59:22 +0200 |
commit | 2066be06213cd70fdeae42a6194bc645a15d9835 (patch) | |
tree | bfec1f0e558a68078f137c0cc6ed4d52fe9bc197 /tests | |
parent | 1af0421efe7983eb5634440ec162da48518b0b78 (diff) | |
download | hakyll-2066be06213cd70fdeae42a6194bc645a15d9835.tar.gz |
Add inHakyllDirectory function and test cases
Diffstat (limited to 'tests')
-rw-r--r-- | tests/File.hs | 20 | ||||
-rw-r--r-- | tests/Page.hs | 3 |
2 files changed, 21 insertions, 2 deletions
diff --git a/tests/File.hs b/tests/File.hs index bdc97a1..9c1ae67 100644 --- a/tests/File.hs +++ b/tests/File.hs @@ -4,6 +4,7 @@ module File import qualified Data.Map as M +import Control.Applicative ((<$>)) import Data.Binary import Test.Framework (testGroup) import Test.Framework.Providers.HUnit @@ -11,6 +12,7 @@ import Test.Framework.Providers.QuickCheck2 import Test.HUnit import Test.QuickCheck +import Text.Hakyll (runDefaultHakyll) import Text.Hakyll.File -- File test group. @@ -18,6 +20,10 @@ fileGroup = testGroup "File" [ testCase "test_toRoot_1" test_toRoot_1 , testCase "test_toRoot_2" test_toRoot_2 , testCase "test_toRoot_3" test_toRoot_3 + , testCase "test_inHakyllDirectory_1" test_inHakyllDirectory_1 + , testCase "test_inHakyllDirectory_2" test_inHakyllDirectory_2 + , testCase "test_inHakyllDirectory_3" test_inHakyllDirectory_3 + , testCase "test_inHakyllDirectory_4" test_inHakyllDirectory_4 , testCase "test_removeSpaces_1" test_removeSpaces_1 , testCase "test_removeSpaces_2" test_removeSpaces_2 , testCase "test_havingExtension_1" test_havingExtension_1 @@ -30,6 +36,20 @@ test_toRoot_1 = toRoot "/posts/foo.html" @?= ".." test_toRoot_2 = toRoot "posts/foo.html" @?= ".." test_toRoot_3 = toRoot "foo.html" @?= "." +-- inHakyllDirectory test cases +test_inHakyllDirectory_1 = + (runDefaultHakyll $ inHakyllDirectory "_site/foo.html") + @? "test_inHakyllDirectory_1" +test_inHakyllDirectory_2 = + (not <$> (runDefaultHakyll $ inHakyllDirectory "posts/foo.html")) + @? "test_inHakyllDirectory_2" +test_inHakyllDirectory_3 = + (not <$> (runDefaultHakyll $ inHakyllDirectory "index.html")) + @? "test_inHakyllDirectory_3" +test_inHakyllDirectory_4 = + (runDefaultHakyll $ inHakyllDirectory "_cache/index.html") + @? "test_inHakyllDirectory_4" + -- removeSpaces test cases test_removeSpaces_1 = removeSpaces "$root/tags/random crap.html" @?= "$root/tags/random-crap.html" diff --git a/tests/Page.hs b/tests/Page.hs index d12638e..27163b2 100644 --- a/tests/Page.hs +++ b/tests/Page.hs @@ -35,8 +35,7 @@ test_readPage fileName content assertion = do temporaryDir <- getTemporaryDirectory let temporaryFile = temporaryDir </> fileName writeFile temporaryFile content - page <- runReaderT (readPage temporaryFile) - (defaultHakyllConfiguration "http://examples.com") + page <- runDefaultHakyll (readPage temporaryFile) removeFile temporaryFile return $ assertion page |