diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2014-01-03 15:56:27 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2014-01-03 15:56:27 +0100 |
commit | 55a389ee7c9a33337679d24c669c4556cbd77cab (patch) | |
tree | d8456c72ea9337e03641830f01bc955208da901f /tests/Hakyll/Core/Routes/Tests.hs | |
parent | 6ba9099225f6325560e5933df974fbc06faa3951 (diff) | |
download | hakyll-55a389ee7c9a33337679d24c669c4556cbd77cab.tar.gz |
Add a test for metadataRoute
Diffstat (limited to 'tests/Hakyll/Core/Routes/Tests.hs')
-rw-r--r-- | tests/Hakyll/Core/Routes/Tests.hs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/Hakyll/Core/Routes/Tests.hs b/tests/Hakyll/Core/Routes/Tests.hs index c681c99..4f975ae 100644 --- a/tests/Hakyll/Core/Routes/Tests.hs +++ b/tests/Hakyll/Core/Routes/Tests.hs @@ -6,6 +6,8 @@ module Hakyll.Core.Routes.Tests -------------------------------------------------------------------------------- +import qualified Data.Map as M +import System.FilePath ((</>)) import Test.Framework (Test, testGroup) import Test.HUnit (Assertion, (@=?)) @@ -33,12 +35,18 @@ tests = testGroup "Hakyll.Core.Routes.Tests" $ fromAssertions "runRoutes" , testRoutes "tags/bar.xml" (gsubRoute "rss/" (const "") `composeRoutes` setExtension "xml") "tags/rss/bar" + + , testRoutes "food/example.md" (metadataRoute $ \md -> customRoute $ \id' -> + M.findWithDefault "?" "subblog" md </> toFilePath id') + "example.md" ] -------------------------------------------------------------------------------- testRoutes :: FilePath -> Routes -> Identifier -> Assertion testRoutes expected r id' = do - (route, _) <- runRoutes r - (error "Hakyll.Core.Routes.Tests: no provider") id' + store <- newTestStore + provider <- newTestProvider store + (route, _) <- runRoutes r provider id' Just expected @=? route + cleanTestEnv |