From 2db34f050aa250c4c11a35cb201cc1c7a28d083d Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Mon, 17 Oct 2016 11:05:25 +0200 Subject: Move from test-framework to tasty --- tests/Hakyll/Core/Dependencies/Tests.hs | 6 +++--- tests/Hakyll/Core/Identifier/Tests.hs | 10 +++++----- tests/Hakyll/Core/Provider/Metadata/Tests.hs | 6 +++--- tests/Hakyll/Core/Provider/Tests.hs | 7 +++---- tests/Hakyll/Core/Routes/Tests.hs | 6 +++--- tests/Hakyll/Core/Rules/Tests.hs | 6 +++--- tests/Hakyll/Core/Runtime/Tests.hs | 6 +++--- tests/Hakyll/Core/Store/Tests.hs | 18 +++++++++--------- tests/Hakyll/Core/UnixFilter/Tests.hs | 10 +++++----- tests/Hakyll/Core/Util/String/Tests.hs | 6 +++--- tests/Hakyll/Web/CompressCss/Tests.hs | 12 ++++++------ tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs | 7 ++++--- tests/Hakyll/Web/Html/Tests.hs | 8 ++++---- tests/Hakyll/Web/Pandoc/FileType/Tests.hs | 6 +++--- tests/Hakyll/Web/Template/Context/Tests.hs | 9 ++++----- tests/Hakyll/Web/Template/Tests.hs | 8 ++++---- tests/TestSuite.hs | 4 ++-- tests/TestSuite/Util.hs | 21 ++++++++++----------- 18 files changed, 77 insertions(+), 79 deletions(-) (limited to 'tests') diff --git a/tests/Hakyll/Core/Dependencies/Tests.hs b/tests/Hakyll/Core/Dependencies/Tests.hs index efa848b..c66d55b 100644 --- a/tests/Hakyll/Core/Dependencies/Tests.hs +++ b/tests/Hakyll/Core/Dependencies/Tests.hs @@ -9,8 +9,8 @@ module Hakyll.Core.Dependencies.Tests import Data.List (delete) import qualified Data.Map as M import qualified Data.Set as S -import Test.Framework (Test, testGroup) -import Test.HUnit (Assertion, (@=?)) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (Assertion, (@=?)) -------------------------------------------------------------------------------- @@ -20,7 +20,7 @@ import TestSuite.Util -------------------------------------------------------------------------------- -tests :: Test +tests :: TestTree tests = testGroup "Hakyll.Core.Dependencies.Tests" $ fromAssertions "analyze" [case01, case02, case03] diff --git a/tests/Hakyll/Core/Identifier/Tests.hs b/tests/Hakyll/Core/Identifier/Tests.hs index 5c318e7..a5de85a 100644 --- a/tests/Hakyll/Core/Identifier/Tests.hs +++ b/tests/Hakyll/Core/Identifier/Tests.hs @@ -6,8 +6,8 @@ module Hakyll.Core.Identifier.Tests -------------------------------------------------------------------------------- -import Test.Framework (Test, testGroup) -import Test.HUnit ((@=?)) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit ((@=?)) -------------------------------------------------------------------------------- @@ -17,7 +17,7 @@ import TestSuite.Util -------------------------------------------------------------------------------- -tests :: Test +tests :: TestTree tests = testGroup "Hakyll.Core.Identifier.Tests" $ concat [ captureTests , matchesTests @@ -25,7 +25,7 @@ tests = testGroup "Hakyll.Core.Identifier.Tests" $ concat -------------------------------------------------------------------------------- -captureTests :: [Test] +captureTests :: [TestTree] captureTests = fromAssertions "capture" [ Just ["bar"] @=? capture "foo/**" "foo/bar" , Just ["foo/bar"] @=? capture "**" "foo/bar" @@ -46,7 +46,7 @@ captureTests = fromAssertions "capture" -------------------------------------------------------------------------------- -matchesTests :: [Test] +matchesTests :: [TestTree] matchesTests = fromAssertions "matches" [ True @=? matches (fromList ["foo.markdown"]) "foo.markdown" , False @=? matches (fromList ["foo"]) (setVersion (Just "x") "foo") diff --git a/tests/Hakyll/Core/Provider/Metadata/Tests.hs b/tests/Hakyll/Core/Provider/Metadata/Tests.hs index a640f42..4e117f4 100644 --- a/tests/Hakyll/Core/Provider/Metadata/Tests.hs +++ b/tests/Hakyll/Core/Provider/Metadata/Tests.hs @@ -10,13 +10,13 @@ import qualified Data.Text as T import qualified Data.Yaml as Yaml import Hakyll.Core.Metadata import Hakyll.Core.Provider.Metadata -import Test.Framework (Test, testGroup) -import Test.HUnit (Assertion, (@=?), assertFailure) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (Assertion, assertFailure, (@=?)) import TestSuite.Util -------------------------------------------------------------------------------- -tests :: Test +tests :: TestTree tests = testGroup "Hakyll.Core.Provider.Metadata.Tests" $ fromAssertions "page" [testPage01, testPage02] diff --git a/tests/Hakyll/Core/Provider/Tests.hs b/tests/Hakyll/Core/Provider/Tests.hs index 8a505d2..d1c542a 100644 --- a/tests/Hakyll/Core/Provider/Tests.hs +++ b/tests/Hakyll/Core/Provider/Tests.hs @@ -8,14 +8,13 @@ module Hakyll.Core.Provider.Tests -------------------------------------------------------------------------------- import Hakyll.Core.Metadata import Hakyll.Core.Provider -import Test.Framework (Test, testGroup) -import Test.Framework.Providers.HUnit (testCase) -import Test.HUnit (Assertion, assert, (@=?)) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (Assertion, assert, testCase, (@=?)) import TestSuite.Util -------------------------------------------------------------------------------- -tests :: Test +tests :: TestTree tests = testGroup "Hakyll.Core.Provider.Tests" [ testCase "case01" case01 ] diff --git a/tests/Hakyll/Core/Routes/Tests.hs b/tests/Hakyll/Core/Routes/Tests.hs index 5a833b0..fc3d676 100644 --- a/tests/Hakyll/Core/Routes/Tests.hs +++ b/tests/Hakyll/Core/Routes/Tests.hs @@ -11,13 +11,13 @@ import Hakyll.Core.Identifier import Hakyll.Core.Metadata import Hakyll.Core.Routes import System.FilePath (()) -import Test.Framework (Test, testGroup) -import Test.HUnit (Assertion, (@=?)) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (Assertion, (@=?)) import TestSuite.Util -------------------------------------------------------------------------------- -tests :: Test +tests :: TestTree tests = testGroup "Hakyll.Core.Routes.Tests" $ fromAssertions "runRoutes" [ testRoutes "foo.html" (setExtension "html") "foo" , testRoutes "foo.html" (setExtension ".html") "foo" diff --git a/tests/Hakyll/Core/Rules/Tests.hs b/tests/Hakyll/Core/Rules/Tests.hs index ec81c1c..e3d9c20 100644 --- a/tests/Hakyll/Core/Rules/Tests.hs +++ b/tests/Hakyll/Core/Rules/Tests.hs @@ -19,13 +19,13 @@ import Hakyll.Core.Rules import Hakyll.Core.Rules.Internal import Hakyll.Web.Pandoc import System.FilePath (()) -import Test.Framework (Test, testGroup) -import Test.HUnit (Assertion, assert, (@=?)) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (Assertion, assert, (@=?)) import TestSuite.Util -------------------------------------------------------------------------------- -tests :: Test +tests :: TestTree tests = testGroup "Hakyll.Core.Rules.Tests" $ fromAssertions "runRules" [case01] diff --git a/tests/Hakyll/Core/Runtime/Tests.hs b/tests/Hakyll/Core/Runtime/Tests.hs index 1bdfc60..5f27854 100644 --- a/tests/Hakyll/Core/Runtime/Tests.hs +++ b/tests/Hakyll/Core/Runtime/Tests.hs @@ -8,8 +8,8 @@ module Hakyll.Core.Runtime.Tests -------------------------------------------------------------------------------- import qualified Data.ByteString as B import System.FilePath (()) -import Test.Framework (Test, testGroup) -import Test.HUnit (Assertion, (@?=)) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (Assertion, (@?=)) -------------------------------------------------------------------------------- @@ -20,7 +20,7 @@ import TestSuite.Util -------------------------------------------------------------------------------- -tests :: Test +tests :: TestTree tests = testGroup "Hakyll.Core.Runtime.Tests" $ fromAssertions "run" [case01, case02] diff --git a/tests/Hakyll/Core/Store/Tests.hs b/tests/Hakyll/Core/Store/Tests.hs index 0aa1aa4..be39ced 100644 --- a/tests/Hakyll/Core/Store/Tests.hs +++ b/tests/Hakyll/Core/Store/Tests.hs @@ -6,22 +6,22 @@ module Hakyll.Core.Store.Tests -------------------------------------------------------------------------------- -import Data.Typeable (typeOf) -import Test.Framework (Test, testGroup) -import Test.Framework.Providers.HUnit (testCase) -import Test.Framework.Providers.QuickCheck2 (testProperty) -import qualified Test.HUnit as H -import qualified Test.QuickCheck as Q -import qualified Test.QuickCheck.Monadic as Q +import Data.Typeable (typeOf) +import qualified Test.QuickCheck as Q +import qualified Test.QuickCheck.Monadic as Q +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (testCase) +import qualified Test.Tasty.HUnit as H +import Test.Tasty.QuickCheck (testProperty) -------------------------------------------------------------------------------- -import qualified Hakyll.Core.Store as Store +import qualified Hakyll.Core.Store as Store import TestSuite.Util -------------------------------------------------------------------------------- -tests :: Test +tests :: TestTree tests = testGroup "Hakyll.Core.Store.Tests" [ testProperty "simple get . set" simpleSetGet , testProperty "persistent get . set" persistentSetGet diff --git a/tests/Hakyll/Core/UnixFilter/Tests.hs b/tests/Hakyll/Core/UnixFilter/Tests.hs index 92c2904..255b043 100644 --- a/tests/Hakyll/Core/UnixFilter/Tests.hs +++ b/tests/Hakyll/Core/UnixFilter/Tests.hs @@ -6,10 +6,10 @@ module Hakyll.Core.UnixFilter.Tests -------------------------------------------------------------------------------- -import Data.List (isInfixOf) -import Test.Framework (Test, testGroup) -import Test.Framework.Providers.HUnit (testCase) -import qualified Test.HUnit as H +import Data.List (isInfixOf) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (testCase) +import qualified Test.Tasty.HUnit as H -------------------------------------------------------------------------------- @@ -21,7 +21,7 @@ import TestSuite.Util -------------------------------------------------------------------------------- -tests :: Test +tests :: TestTree tests = testGroup "Hakyll.Core.UnixFilter.Tests" [ testCase "unixFilter rev" unixFilterRev , testCase "unixFilter false" unixFilterFalse diff --git a/tests/Hakyll/Core/Util/String/Tests.hs b/tests/Hakyll/Core/Util/String/Tests.hs index 56bdd1a..e9c27ae 100644 --- a/tests/Hakyll/Core/Util/String/Tests.hs +++ b/tests/Hakyll/Core/Util/String/Tests.hs @@ -5,8 +5,8 @@ module Hakyll.Core.Util.String.Tests -------------------------------------------------------------------------------- -import Test.Framework (Test, testGroup) -import Test.HUnit ((@=?)) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit ((@=?)) -------------------------------------------------------------------------------- @@ -15,7 +15,7 @@ import TestSuite.Util -------------------------------------------------------------------------------- -tests :: Test +tests :: TestTree tests = testGroup "Hakyll.Core.Util.String.Tests" $ concat [ fromAssertions "trim" [ "foo" @=? trim " foo\n\t " diff --git a/tests/Hakyll/Web/CompressCss/Tests.hs b/tests/Hakyll/Web/CompressCss/Tests.hs index b356388..8521014 100644 --- a/tests/Hakyll/Web/CompressCss/Tests.hs +++ b/tests/Hakyll/Web/CompressCss/Tests.hs @@ -5,9 +5,9 @@ module Hakyll.Web.CompressCss.Tests -------------------------------------------------------------------------------- -import Data.Char (toUpper) -import Test.Framework (Test, testGroup) -import Test.HUnit (assert, (@=?)) +import Data.Char (toUpper) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (assert, (@=?)) -------------------------------------------------------------------------------- @@ -16,10 +16,10 @@ import TestSuite.Util -------------------------------------------------------------------------------- -tests :: Test +tests :: TestTree tests = testGroup "Hakyll.Web.CompressCss.Tests" $ concat [ fromAssertions "compressCss" - [ + [ -- compress whitespace " something something " @=? compressCss " something \n\t\r something " @@ -32,7 +32,7 @@ tests = testGroup "Hakyll.Web.CompressCss.Tests" $ concat -- strip comments , "before after" @=? compressCss "before /* abc { } ;; \n\t\r */ after" -- don't strip comments inside constants - , "before \"/* abc { } ;; \n\t\r */\" after" + , "before \"/* abc { } ;; \n\t\r */\" after" @=? compressCss "before \"/* abc { } ;; \n\t\r */\" after" -- compress separators diff --git a/tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs b/tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs index 4d9421e..658145d 100644 --- a/tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs +++ b/tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs @@ -6,8 +6,9 @@ module Hakyll.Web.Html.RelativizeUrls.Tests -------------------------------------------------------------------------------- -import Test.Framework (Test, testGroup) -import Test.HUnit ((@=?)) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit ((@=?)) + -------------------------------------------------------------------------------- import Hakyll.Web.Html.RelativizeUrls @@ -15,7 +16,7 @@ import TestSuite.Util -------------------------------------------------------------------------------- -tests :: Test +tests :: TestTree tests = testGroup "Hakyll.Web.Html.RelativizeUrls.Tests" $ fromAssertions "relativizeUrls" [ "bar" @=? diff --git a/tests/Hakyll/Web/Html/Tests.hs b/tests/Hakyll/Web/Html/Tests.hs index bad5ebc..efb4099 100644 --- a/tests/Hakyll/Web/Html/Tests.hs +++ b/tests/Hakyll/Web/Html/Tests.hs @@ -5,9 +5,9 @@ module Hakyll.Web.Html.Tests -------------------------------------------------------------------------------- -import Data.Char (toUpper) -import Test.Framework (Test, testGroup) -import Test.HUnit (assert, (@=?)) +import Data.Char (toUpper) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (assert, (@=?)) -------------------------------------------------------------------------------- @@ -16,7 +16,7 @@ import TestSuite.Util -------------------------------------------------------------------------------- -tests :: Test +tests :: TestTree tests = testGroup "Hakyll.Web.Html.Tests" $ concat [ fromAssertions "demoteHeaders" [ "

A h1 title

" @=? diff --git a/tests/Hakyll/Web/Pandoc/FileType/Tests.hs b/tests/Hakyll/Web/Pandoc/FileType/Tests.hs index e6b222f..7797107 100644 --- a/tests/Hakyll/Web/Pandoc/FileType/Tests.hs +++ b/tests/Hakyll/Web/Pandoc/FileType/Tests.hs @@ -6,8 +6,8 @@ module Hakyll.Web.Pandoc.FileType.Tests -------------------------------------------------------------------------------- -import Test.Framework (Test, testGroup) -import Test.HUnit ((@=?)) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit ((@=?)) -------------------------------------------------------------------------------- @@ -16,7 +16,7 @@ import TestSuite.Util -------------------------------------------------------------------------------- -tests :: Test +tests :: TestTree tests = testGroup "Hakyll.Web.Pandoc.FileType.Tests" $ fromAssertions "fileType" [ Markdown @=? fileType "index.md" diff --git a/tests/Hakyll/Web/Template/Context/Tests.hs b/tests/Hakyll/Web/Template/Context/Tests.hs index 5f77dad..f263391 100644 --- a/tests/Hakyll/Web/Template/Context/Tests.hs +++ b/tests/Hakyll/Web/Template/Context/Tests.hs @@ -6,22 +6,21 @@ module Hakyll.Web.Template.Context.Tests -------------------------------------------------------------------------------- -import Test.Framework (Test, testGroup) -import Test.Framework.Providers.HUnit (testCase) -import Test.HUnit (Assertion, (@=?)) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (Assertion, testCase, (@=?)) -------------------------------------------------------------------------------- import Hakyll.Core.Compiler import Hakyll.Core.Identifier import Hakyll.Core.Provider -import Hakyll.Core.Store (Store) +import Hakyll.Core.Store (Store) import Hakyll.Web.Template.Context import TestSuite.Util -------------------------------------------------------------------------------- -tests :: Test +tests :: TestTree tests = testGroup "Hakyll.Core.Template.Context.Tests" [ testCase "testDateField" testDateField ] diff --git a/tests/Hakyll/Web/Template/Tests.hs b/tests/Hakyll/Web/Template/Tests.hs index 994d9ca..1f3b25d 100644 --- a/tests/Hakyll/Web/Template/Tests.hs +++ b/tests/Hakyll/Web/Template/Tests.hs @@ -6,9 +6,9 @@ module Hakyll.Web.Template.Tests -------------------------------------------------------------------------------- -import Test.Framework (Test, testGroup) -import Test.Framework.Providers.HUnit (testCase) -import Test.HUnit (Assertion, (@=?), (@?=)) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (Assertion, testCase, (@=?), + (@?=)) -------------------------------------------------------------------------------- @@ -25,7 +25,7 @@ import TestSuite.Util -------------------------------------------------------------------------------- -tests :: Test +tests :: TestTree tests = testGroup "Hakyll.Core.Template.Tests" $ concat [ [ testCase "case01" $ test ("template.html.out", "template.html", "example.md") , testCase "case02" $ test ("strip.html.out", "strip.html", "example.md") diff --git a/tests/TestSuite.hs b/tests/TestSuite.hs index 79eb314..4260eab 100644 --- a/tests/TestSuite.hs +++ b/tests/TestSuite.hs @@ -5,7 +5,7 @@ module Main -------------------------------------------------------------------------------- -import Test.Framework (defaultMain) +import Test.Tasty (defaultMain, testGroup) -------------------------------------------------------------------------------- @@ -29,7 +29,7 @@ import qualified Hakyll.Web.Template.Tests -------------------------------------------------------------------------------- main :: IO () -main = defaultMain +main = defaultMain $ testGroup "Hakyll" [ Hakyll.Core.Dependencies.Tests.tests , Hakyll.Core.Identifier.Tests.tests , Hakyll.Core.Provider.Metadata.Tests.tests diff --git a/tests/TestSuite/Util.hs b/tests/TestSuite/Util.hs index e727ecb..35ee112 100644 --- a/tests/TestSuite/Util.hs +++ b/tests/TestSuite/Util.hs @@ -12,30 +12,29 @@ module TestSuite.Util -------------------------------------------------------------------------------- -import Data.List (intercalate) -import Data.Monoid (mempty) -import qualified Data.Set as S -import Test.Framework -import Test.Framework.Providers.HUnit -import Test.HUnit hiding (Test) -import Text.Printf (printf) +import Data.List (intercalate) +import Data.Monoid (mempty) +import qualified Data.Set as S +import Test.Tasty +import Test.Tasty.HUnit +import Text.Printf (printf) -------------------------------------------------------------------------------- import Hakyll.Core.Compiler.Internal import Hakyll.Core.Configuration import Hakyll.Core.Identifier -import qualified Hakyll.Core.Logger as Logger +import qualified Hakyll.Core.Logger as Logger import Hakyll.Core.Provider -import Hakyll.Core.Store (Store) -import qualified Hakyll.Core.Store as Store +import Hakyll.Core.Store (Store) +import qualified Hakyll.Core.Store as Store import Hakyll.Core.Util.File -------------------------------------------------------------------------------- fromAssertions :: String -- ^ Name -> [Assertion] -- ^ Cases - -> [Test] -- ^ Result tests + -> [TestTree] -- ^ Result tests fromAssertions name = zipWith testCase [printf "[%2d] %s" n name | n <- [1 :: Int ..]] -- cgit v1.2.3