diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-02-13 22:40:11 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-02-13 22:48:13 +0100 |
commit | f5c9c6fa32cd330a0daa4d6cbff9fcae53d317cc (patch) | |
tree | a55f7b811ff4cf23f9c958728df4cff594b31b60 /tests | |
parent | 75b8c3e0d2d4fb20602e61ef190205dacc9cd5ec (diff) | |
download | hakyll-f5c9c6fa32cd330a0daa4d6cbff9fcae53d317cc.tar.gz |
Add a test for byExtension
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Hakyll/Core/Compiler/Tests.hs | 35 | ||||
-rw-r--r-- | tests/TestSuite.hs | 5 |
2 files changed, 39 insertions, 1 deletions
diff --git a/tests/Hakyll/Core/Compiler/Tests.hs b/tests/Hakyll/Core/Compiler/Tests.hs new file mode 100644 index 0000000..7ea7190 --- /dev/null +++ b/tests/Hakyll/Core/Compiler/Tests.hs @@ -0,0 +1,35 @@ +{-# LANGUAGE OverloadedStrings #-} +module Hakyll.Core.Compiler.Tests + where + +import qualified Data.Map as M + +import Test.Framework (Test) +import Test.Framework.Providers.HUnit (testCase) +import qualified Test.HUnit as H + +import Hakyll.Core.Compiler +import Hakyll.Core.Resource.Provider.Dummy +import Hakyll.Core.Util.Arrow +import TestSuite.Util + +tests :: [Test] +tests = + [ testCase "byExtension" byExtensionTest + ] + +byExtensionTest :: H.Assertion +byExtensionTest = do + provider <- dummyResourceProvider $ M.empty + txt <- runCompilerJobTest compiler "foo.txt" provider uni + css <- runCompilerJobTest compiler "bar.css" provider uni + html <- runCompilerJobTest compiler "qux.html" provider uni + H.assertEqual "byExtension" "txt" txt + H.assertEqual "byExtension" "css" css + H.assertEqual "byExtension" "unknown" html + where + uni = ["foo.txt", "bar.css", "qux.html"] + compiler = byExtension (constA ("unknown" :: String)) + [ (".txt", constA "txt") + , (".css", constA "css") + ] diff --git a/tests/TestSuite.hs b/tests/TestSuite.hs index 70ebe98..4eb657b 100644 --- a/tests/TestSuite.hs +++ b/tests/TestSuite.hs @@ -2,6 +2,7 @@ module Main where import Test.Framework (defaultMain, testGroup) +import qualified Hakyll.Core.Compiler.Tests import qualified Hakyll.Core.DependencyAnalyzer.Tests import qualified Hakyll.Core.Identifier.Tests import qualified Hakyll.Core.Routes.Tests @@ -19,7 +20,9 @@ import qualified Hakyll.Web.Util.Html.Tests main :: IO () main = defaultMain - [ testGroup "Hakyll.Core.DependencyAnalyzer.Tests" + [ testGroup "Hakyll.Core.Compiler.Tests" + Hakyll.Core.Compiler.Tests.tests + , testGroup "Hakyll.Core.DependencyAnalyzer.Tests" Hakyll.Core.DependencyAnalyzer.Tests.tests , testGroup "Hakyll.Core.Identifier.Tests" Hakyll.Core.Identifier.Tests.tests |