diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Hakyll/Core/Routes/Tests.hs | 4 | ||||
-rw-r--r-- | tests/Hakyll/Core/Rules/Tests.hs | 4 | ||||
-rw-r--r-- | tests/Hakyll/Core/UnixFilter/Tests.hs | 8 | ||||
-rw-r--r-- | tests/Hakyll/Web/Html/Tests.hs | 1 | ||||
-rw-r--r-- | tests/Hakyll/Web/Template/Tests.hs | 6 |
5 files changed, 18 insertions, 5 deletions
diff --git a/tests/Hakyll/Core/Routes/Tests.hs b/tests/Hakyll/Core/Routes/Tests.hs index fc3d676..a3e1736 100644 --- a/tests/Hakyll/Core/Routes/Tests.hs +++ b/tests/Hakyll/Core/Routes/Tests.hs @@ -10,7 +10,7 @@ import Data.Maybe (fromMaybe) import Hakyll.Core.Identifier import Hakyll.Core.Metadata import Hakyll.Core.Routes -import System.FilePath ((</>)) +import System.FilePath ((</>), normalise) import Test.Tasty (TestTree, testGroup) import Test.Tasty.HUnit (Assertion, (@=?)) import TestSuite.Util @@ -46,5 +46,5 @@ testRoutes expected r id' = do store <- newTestStore provider <- newTestProvider store (route, _) <- runRoutes r provider id' - Just expected @=? route + Just (normalise expected) @=? route cleanTestEnv diff --git a/tests/Hakyll/Core/Rules/Tests.hs b/tests/Hakyll/Core/Rules/Tests.hs index 24b5b8c..80baf02 100644 --- a/tests/Hakyll/Core/Rules/Tests.hs +++ b/tests/Hakyll/Core/Rules/Tests.hs @@ -17,7 +17,7 @@ import Hakyll.Core.Metadata import Hakyll.Core.Routes import Hakyll.Core.Rules import Hakyll.Core.Rules.Internal -import System.FilePath ((</>)) +import System.FilePath ((</>), normalise) import Test.Tasty (TestTree, testGroup) import Test.Tasty.HUnit (Assertion, (@=?)) import TestSuite.Util @@ -39,7 +39,7 @@ case01 = do let identifiers = S.fromList $ map fst $ rulesCompilers ruleSet routes = rulesRoutes ruleSet checkRoute ex i = - runRoutes routes provider i >>= \(r, _) -> Just ex @=? r + runRoutes routes provider i >>= \(r, _) -> Just (normalise ex) @=? r -- Test that we have some identifiers and that the routes work out S.fromList expected @=? identifiers diff --git a/tests/Hakyll/Core/UnixFilter/Tests.hs b/tests/Hakyll/Core/UnixFilter/Tests.hs index e4e0f23..314967e 100644 --- a/tests/Hakyll/Core/UnixFilter/Tests.hs +++ b/tests/Hakyll/Core/UnixFilter/Tests.hs @@ -1,5 +1,6 @@ -------------------------------------------------------------------------------- {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE CPP #-} module Hakyll.Core.UnixFilter.Tests ( tests ) where @@ -22,10 +23,17 @@ import TestSuite.Util -------------------------------------------------------------------------------- tests :: TestTree tests = testGroup "Hakyll.Core.UnixFilter.Tests" +#ifdef mingw32_HOST_OS + -- The `rev` utility is not present by default on Windows + [ testCase "unixFilter false" unixFilterFalse + , testCase "unixFilter error" unixFilterError + ] +#else [ testCase "unixFilter rev" unixFilterRev , testCase "unixFilter false" unixFilterFalse , testCase "unixFilter error" unixFilterError ] +#endif testMarkdown :: Identifier testMarkdown = "russian.md" diff --git a/tests/Hakyll/Web/Html/Tests.hs b/tests/Hakyll/Web/Html/Tests.hs index 3d0a887..cd362f4 100644 --- a/tests/Hakyll/Web/Html/Tests.hs +++ b/tests/Hakyll/Web/Html/Tests.hs @@ -44,6 +44,7 @@ tests = testGroup "Hakyll.Web.Html.Tests" $ concat , fromAssertions "toUrl" [ "/foo/bar.html" @=? toUrl "foo/bar.html" + , "/foo/bar.html" @=? toUrl "foo\\bar.html" -- Windows-specific , "/" @=? toUrl "/" , "/funny-pics.html" @=? toUrl "/funny-pics.html" , "/funny%20pics.html" @=? toUrl "funny pics.html" diff --git a/tests/Hakyll/Web/Template/Tests.hs b/tests/Hakyll/Web/Template/Tests.hs index a73b92d..1c7c571 100644 --- a/tests/Hakyll/Web/Template/Tests.hs +++ b/tests/Hakyll/Web/Template/Tests.hs @@ -12,6 +12,7 @@ import Test.Tasty.HUnit (Assertion, assertBool, testCase, (@=?), (@?=)) import Data.Either (isLeft) +import System.IO (nativeNewline, Newline(..)) -------------------------------------------------------------------------------- import Hakyll.Core.Compiler @@ -149,8 +150,11 @@ testEmbeddedTemplate = do str <- testCompilerDone store provider "item3" $ applyTemplate embeddedTemplate defaultContext item - itemBody str @?= "<p>Hello, world</p>\n" + itemBody str @?= ("<p>Hello, world</p>" ++ (newline nativeNewline)) cleanTestEnv where item = Item "item1" "Hello, world" + + newline LF = "\n" + newline CRLF = "\r\n" |