2011-02-09 17:11:24 +00:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
module Hakyll.Core.Routes.Tests
|
|
|
|
( tests
|
|
|
|
) where
|
|
|
|
|
|
|
|
import Test.Framework
|
|
|
|
import Test.HUnit hiding (Test)
|
|
|
|
|
2012-05-29 21:39:07 +00:00
|
|
|
import Hakyll.Core.Identifier
|
2011-02-09 17:11:24 +00:00
|
|
|
import Hakyll.Core.Routes
|
|
|
|
import TestSuite.Util
|
|
|
|
|
|
|
|
tests :: [Test]
|
|
|
|
tests = fromAssertions "runRoutes"
|
|
|
|
[ Just "foo.html" @=? runRoutes (setExtension "html") "foo"
|
|
|
|
, Just "foo.html" @=? runRoutes (setExtension ".html") "foo"
|
|
|
|
, Just "foo.html" @=? runRoutes (setExtension "html") "foo.markdown"
|
|
|
|
, Just "foo.html" @=? runRoutes (setExtension ".html") "foo.markdown"
|
2011-02-28 21:40:23 +00:00
|
|
|
|
2012-05-29 21:39:07 +00:00
|
|
|
, Just "neve ro ddo reven" @=?
|
|
|
|
runRoutes (customRoute (reverse . toFilePath )) "never odd or even"
|
|
|
|
|
|
|
|
, Just "foo" @=? runRoutes (constRoute "foo") "bar"
|
|
|
|
|
2011-02-28 21:40:23 +00:00
|
|
|
, Just "tags/bar.xml" @=?
|
|
|
|
runRoutes (gsubRoute "rss/" (const "")) "tags/rss/bar.xml"
|
2011-03-01 08:40:07 +00:00
|
|
|
, Just "tags/bar.xml" @=?
|
|
|
|
runRoutes (gsubRoute "rss/" (const "") `composeRoutes`
|
|
|
|
setExtension "xml") "tags/rss/bar"
|
2011-02-09 17:11:24 +00:00
|
|
|
]
|