summaryrefslogtreecommitdiff
path: root/tests/Hakyll
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Hakyll')
-rw-r--r--tests/Hakyll/Core/Provider/Tests.hs4
-rw-r--r--tests/Hakyll/Core/Rules/Tests.hs4
-rw-r--r--tests/Hakyll/Core/Store/Tests.hs14
-rw-r--r--tests/Hakyll/Core/UnixFilter/Tests.hs16
-rw-r--r--tests/Hakyll/Web/Html/Tests.hs12
5 files changed, 25 insertions, 25 deletions
diff --git a/tests/Hakyll/Core/Provider/Tests.hs b/tests/Hakyll/Core/Provider/Tests.hs
index d1c542a..ebb2a15 100644
--- a/tests/Hakyll/Core/Provider/Tests.hs
+++ b/tests/Hakyll/Core/Provider/Tests.hs
@@ -9,7 +9,7 @@ module Hakyll.Core.Provider.Tests
import Hakyll.Core.Metadata
import Hakyll.Core.Provider
import Test.Tasty (TestTree, testGroup)
-import Test.Tasty.HUnit (Assertion, assert, testCase, (@=?))
+import Test.Tasty.HUnit (Assertion, testCase, (@=?))
import TestSuite.Util
@@ -25,7 +25,7 @@ case01 :: Assertion
case01 = do
store <- newTestStore
provider <- newTestProvider store
- assert $ resourceExists provider "example.md"
+ True @=? resourceExists provider "example.md"
metadata <- resourceMetadata provider "example.md"
Just "An example" @=? lookupString "title" metadata
diff --git a/tests/Hakyll/Core/Rules/Tests.hs b/tests/Hakyll/Core/Rules/Tests.hs
index e3d9c20..c4c0f28 100644
--- a/tests/Hakyll/Core/Rules/Tests.hs
+++ b/tests/Hakyll/Core/Rules/Tests.hs
@@ -20,7 +20,7 @@ import Hakyll.Core.Rules.Internal
import Hakyll.Web.Pandoc
import System.FilePath ((</>))
import Test.Tasty (TestTree, testGroup)
-import Test.Tasty.HUnit (Assertion, assert, (@=?))
+import Test.Tasty.HUnit (Assertion, (@=?))
import TestSuite.Util
@@ -50,7 +50,7 @@ case01 = do
checkRoute "example.mv1" (sv "mv1" "example.md")
checkRoute "example.mv2" (sv "mv2" "example.md")
checkRoute "food/example.md" (sv "metadataMatch" "example.md")
- readIORef ioref >>= assert
+ readIORef ioref >>= (True @=?)
cleanTestEnv
where
sv g = setVersion (Just g)
diff --git a/tests/Hakyll/Core/Store/Tests.hs b/tests/Hakyll/Core/Store/Tests.hs
index be39ced..28deb28 100644
--- a/tests/Hakyll/Core/Store/Tests.hs
+++ b/tests/Hakyll/Core/Store/Tests.hs
@@ -63,11 +63,11 @@ wrongType = do
-- Store a string and try to fetch an int
Store.set store ["foo", "bar"] ("qux" :: String)
value <- Store.get store ["foo", "bar"] :: IO (Store.Result Int)
- H.assert $ case value of
- Store.WrongType e t ->
- e == typeOf (undefined :: Int) &&
- t == typeOf (undefined :: String)
- _ -> False
+ case value of
+ Store.WrongType e t -> do
+ typeOf (undefined :: Int) H.@=? e
+ typeOf (undefined :: String) H.@=? t
+ _ -> H.assertFailure "Expecting WrongType"
cleanTestEnv
@@ -78,6 +78,6 @@ isMembertest = do
Store.set store ["foo", "bar"] ("qux" :: String)
good <- Store.isMember store ["foo", "bar"]
bad <- Store.isMember store ["foo", "baz"]
- H.assert good
- H.assert (not bad)
+ True H.@=? good
+ False H.@=? bad
cleanTestEnv
diff --git a/tests/Hakyll/Core/UnixFilter/Tests.hs b/tests/Hakyll/Core/UnixFilter/Tests.hs
index 521d051..63d6698 100644
--- a/tests/Hakyll/Core/UnixFilter/Tests.hs
+++ b/tests/Hakyll/Core/UnixFilter/Tests.hs
@@ -39,7 +39,7 @@ unixFilterRev = do
provider <- newTestProvider store
output <- testCompilerDone store provider testMarkdown compiler
expected <- testCompilerDone store provider testMarkdown getResourceString
- H.assert $ rev (itemBody expected) == lines (itemBody output)
+ rev (itemBody expected) H.@=? lines (itemBody output)
cleanTestEnv
where
compiler = getResourceString >>= withItemBody (unixFilter "rev" [])
@@ -52,9 +52,9 @@ unixFilterFalse = do
store <- newTestStore
provider <- newTestProvider store
result <- testCompiler store provider testMarkdown compiler
- H.assert $ case result of
- CompilerError es -> any ("exit code" `isInfixOf`) es
- _ -> False
+ case result of
+ CompilerError es -> True H.@=? any ("exit code" `isInfixOf`) es
+ _ -> H.assertFailure "Expecting CompilerError"
cleanTestEnv
where
compiler = getResourceString >>= withItemBody (unixFilter "false" [])
@@ -66,9 +66,9 @@ unixFilterError = do
store <- newTestStore
provider <- newTestProvider store
result <- testCompiler store provider testMarkdown compiler
- H.assert $ case result of
- CompilerError es -> any ("invalid option" `isInfixOf`) es
- _ -> False
+ case result of
+ CompilerError es -> True H.@=? any ("invalid option" `isInfixOf`) es
+ _ -> H.assertFailure "Expecting CompilerError"
cleanTestEnv
where
- compiler = getResourceString >>= withItemBody (unixFilter "head" ["-#"]) \ No newline at end of file
+ compiler = getResourceString >>= withItemBody (unixFilter "head" ["-#"])
diff --git a/tests/Hakyll/Web/Html/Tests.hs b/tests/Hakyll/Web/Html/Tests.hs
index efb4099..3d0a887 100644
--- a/tests/Hakyll/Web/Html/Tests.hs
+++ b/tests/Hakyll/Web/Html/Tests.hs
@@ -7,7 +7,7 @@ module Hakyll.Web.Html.Tests
--------------------------------------------------------------------------------
import Data.Char (toUpper)
import Test.Tasty (TestTree, testGroup)
-import Test.Tasty.HUnit (assert, (@=?))
+import Test.Tasty.HUnit ((@=?))
--------------------------------------------------------------------------------
@@ -64,11 +64,11 @@ tests = testGroup "Hakyll.Web.Html.Tests" $ concat
]
, fromAssertions "isExternal"
- [ assert (isExternal "http://reddit.com")
- , assert (isExternal "https://mail.google.com")
- , assert (isExternal "//ajax.googleapis.com")
- , assert (not (isExternal "../header.png"))
- , assert (not (isExternal "/foo/index.html"))
+ [ True @=? isExternal "http://reddit.com"
+ , True @=? isExternal "https://mail.google.com"
+ , True @=? isExternal "//ajax.googleapis.com"
+ , False @=? isExternal "../header.png"
+ , False @=? isExternal "/foo/index.html"
]
, fromAssertions "stripTags"