@@ -0,0 +1,35 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+module Hakyll.Core.Compiler.Tests
3+ where
4+
5+import qualified Data.Map as M
6+
7+import Test.Framework (Test)
8+import Test.Framework.Providers.HUnit (testCase)
9+import qualified Test.HUnit as H
10+
11+import Hakyll.Core.Compiler
12+import Hakyll.Core.Resource.Provider.Dummy
13+import Hakyll.Core.Util.Arrow
14+import TestSuite.Util
15+
16+tests :: [Test]
17+tests =
18+ [ testCase "byExtension" byExtensionTest
19+ ]
20+
21+byExtensionTest :: H.Assertion
22+byExtensionTest = do
23+ provider <- dummyResourceProvider $ M.empty
24+ txt <- runCompilerJobTest compiler "foo.txt" provider uni
25+ css <- runCompilerJobTest compiler "bar.css" provider uni
26+ html <- runCompilerJobTest compiler "qux.html" provider uni
27+ H.assertEqual "byExtension" "txt" txt
28+ H.assertEqual "byExtension" "css" css
29+ H.assertEqual "byExtension" "unknown" html
30+ where
31+ uni = ["foo.txt", "bar.css", "qux.html"]
32+ compiler = byExtension (constA ("unknown" :: String))
33+ [ (".txt", constA "txt")
34+ , (".css", constA "css")
35+ ]