summaryrefslogtreecommitdiff
path: root/tests/Hakyll/Core/Routes/Tests.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2014-01-03 15:56:27 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2014-01-03 15:56:27 +0100
commit55a389ee7c9a33337679d24c669c4556cbd77cab (patch)
treed8456c72ea9337e03641830f01bc955208da901f /tests/Hakyll/Core/Routes/Tests.hs
parent6ba9099225f6325560e5933df974fbc06faa3951 (diff)
downloadhakyll-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.hs12
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