blob: 8bdbe85fbf2e1d9d9d3b7c0311f28e3d239428cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
--------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
module Hakyll.Core.Routes.Tests
( tests
) where
--------------------------------------------------------------------------------
import Test.Framework (Test, testGroup)
import Test.HUnit ((@=?))
--------------------------------------------------------------------------------
import Hakyll.Core.Identifier
import Hakyll.Core.Routes
import TestSuite.Util
--------------------------------------------------------------------------------
tests :: Test
tests = testGroup "Hakyll.Core.Routes.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"
, Just "neve ro ddo reven" @=?
runRoutes (customRoute (reverse . toFilePath )) "never odd or even"
, Just "foo" @=? runRoutes (constRoute "foo") "bar"
, Just "tags/bar.xml" @=?
runRoutes (gsubRoute "rss/" (const "")) "tags/rss/bar.xml"
, Just "tags/bar.xml" @=?
runRoutes (gsubRoute "rss/" (const "") `composeRoutes`
setExtension "xml") "tags/rss/bar"
]
|