on master help sign in
Move from test-framework to tasty
commit2db34f050aa250c4c11a35cb201cc1c7a28d083d authorJasper Van der Jeugt <m@jaspervdj.be> dateMon 17 Oct 2016, 11:05 (10 years ago) parent43e78fc
21 files changed+85−89
hakyll.cabal+5−7 src/Hakyll/Check.hs+1−1 stack.yaml+2−2 tests/Hakyll/Core/Dependencies/Tests.hs+3−3 tests/Hakyll/Core/Identifier/Tests.hs+5−5 tests/Hakyll/Core/Provider/Metadata/Tests.hs+3−3 tests/Hakyll/Core/Provider/Tests.hs+3−4 tests/Hakyll/Core/Routes/Tests.hs+3−3 tests/Hakyll/Core/Rules/Tests.hs+3−3 tests/Hakyll/Core/Runtime/Tests.hs+3−3 tests/Hakyll/Core/Store/Tests.hs+9−9 tests/Hakyll/Core/UnixFilter/Tests.hs+5−5 tests/Hakyll/Core/Util/String/Tests.hs+3−3 tests/Hakyll/Web/CompressCss/Tests.hs+6−6 tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs+4−3 tests/Hakyll/Web/Html/Tests.hs+4−4 tests/Hakyll/Web/Pandoc/FileType/Tests.hs+3−3 tests/Hakyll/Web/Template/Context/Tests.hs+4−5 tests/Hakyll/Web/Template/Tests.hs+4−4 tests/TestSuite.hs+2−2 tests/TestSuite/Util.hs+10−11
hakyll.cabal+5−7
@@ -232,18 +232,16 @@ Test-suite hakyll-tests
232232 TestSuite.Util
233233
234234 Build-Depends:
235− HUnit >= 1.2 && < 1.4,
236− QuickCheck >= 2.4 && < 2.9,
237− test-framework >= 0.4 && < 0.9,
238− test-framework-hunit >= 0.3 && < 0.4,
239− test-framework-quickcheck2 >= 0.3 && < 0.4,
235+ QuickCheck >= 2.8 && < 2.9,
236+ tasty >= 0.11 && < 0.12,
237+ tasty-hunit >= 0.9 && < 0.10,
238+ tasty-quickcheck >= 0.8 && < 0.9,
240239 -- Copy pasted from hakyll dependencies:
241240 base >= 4.8 && < 5,
242241 binary >= 0.5 && < 0.9,
243242 blaze-html >= 0.5 && < 0.9,
244243 blaze-markup >= 0.5.1 && < 0.8,
245244 bytestring >= 0.9 && < 0.11,
246− cmdargs >= 0.10 && < 0.11,
247245 containers >= 0.3 && < 0.6,
248246 cryptohash >= 0.7 && < 0.12,
249247 data-default >= 0.4 && < 0.8,
@@ -269,7 +267,7 @@ Test-suite hakyll-tests
269267 time-locale-compat >= 0.1 && < 0.2,
270268 unordered-containers >= 0.2 && < 0.3,
271269 vector >= 0.11 && < 0.12,
272− yaml >= 0.8.11 && < 0.9,
270+ yaml >= 0.8.11 && < 0.9,
273271 optparse-applicative >= 0.12 && < 0.13
274272
275273 If flag(previewServer)
src/Hakyll/Check.hs+1−1
@@ -204,7 +204,7 @@ checkExternalUrl url = do
204204 result <- liftIO $ try $ do
205205 mgr <- Http.newManager Http.tlsManagerSettings
206206 runResourceT $ do
207− request <- Http.parseUrl urlToCheck
207+ request <- Http.parseRequest urlToCheck
208208 response <- Http.http (settings request) mgr
209209 let code = Http.statusCode (Http.responseStatus response)
210210 return $ code >= 200 && code < 300
stack.yaml+2−2
@@ -1,6 +1,6 @@
1−resolver: lts-5.11
2−extra-deps: []
1+resolver: lts-6.22
32extra-package-dbs: []
3+extra-deps: []
44
55flags:
66 hakyll:
tests/Hakyll/Core/Dependencies/Tests.hs+3−3
@@ -9,8 +9,8 @@ module Hakyll.Core.Dependencies.Tests
99import Data.List (delete)
1010import qualified Data.Map as M
1111import qualified Data.Set as S
12−import Test.Framework (Test, testGroup)
13−import Test.HUnit (Assertion, (@=?))
12+import Test.Tasty (TestTree, testGroup)
13+import Test.Tasty.HUnit (Assertion, (@=?))
1414
1515
1616--------------------------------------------------------------------------------
@@ -20,7 +20,7 @@ import TestSuite.Util
2020
2121
2222--------------------------------------------------------------------------------
23−tests :: Test
23+tests :: TestTree
2424tests = testGroup "Hakyll.Core.Dependencies.Tests" $
2525 fromAssertions "analyze" [case01, case02, case03]
2626
tests/Hakyll/Core/Identifier/Tests.hs+5−5
@@ -6,8 +6,8 @@ module Hakyll.Core.Identifier.Tests
66
77
88--------------------------------------------------------------------------------
9−import Test.Framework (Test, testGroup)
10−import Test.HUnit ((@=?))
9+import Test.Tasty (TestTree, testGroup)
10+import Test.Tasty.HUnit ((@=?))
1111
1212
1313--------------------------------------------------------------------------------
@@ -17,7 +17,7 @@ import TestSuite.Util
1717
1818
1919--------------------------------------------------------------------------------
20−tests :: Test
20+tests :: TestTree
2121tests = testGroup "Hakyll.Core.Identifier.Tests" $ concat
2222 [ captureTests
2323 , matchesTests
@@ -25,7 +25,7 @@ tests = testGroup "Hakyll.Core.Identifier.Tests" $ concat
2525
2626
2727--------------------------------------------------------------------------------
28−captureTests :: [Test]
28+captureTests :: [TestTree]
2929captureTests = fromAssertions "capture"
3030 [ Just ["bar"] @=? capture "foo/**" "foo/bar"
3131 , Just ["foo/bar"] @=? capture "**" "foo/bar"
@@ -46,7 +46,7 @@ captureTests = fromAssertions "capture"
4646
4747
4848--------------------------------------------------------------------------------
49−matchesTests :: [Test]
49+matchesTests :: [TestTree]
5050matchesTests = fromAssertions "matches"
5151 [ True @=? matches (fromList ["foo.markdown"]) "foo.markdown"
5252 , False @=? matches (fromList ["foo"]) (setVersion (Just "x") "foo")
tests/Hakyll/Core/Provider/Metadata/Tests.hs+3−3
@@ -10,13 +10,13 @@ import qualified Data.Text as T
1010import qualified Data.Yaml as Yaml
1111import Hakyll.Core.Metadata
1212import Hakyll.Core.Provider.Metadata
13−import Test.Framework (Test, testGroup)
14−import Test.HUnit (Assertion, (@=?), assertFailure)
13+import Test.Tasty (TestTree, testGroup)
14+import Test.Tasty.HUnit (Assertion, assertFailure, (@=?))
1515import TestSuite.Util
1616
1717
1818--------------------------------------------------------------------------------
19−tests :: Test
19+tests :: TestTree
2020tests = testGroup "Hakyll.Core.Provider.Metadata.Tests" $
2121 fromAssertions "page" [testPage01, testPage02]
2222
tests/Hakyll/Core/Provider/Tests.hs+3−4
@@ -8,14 +8,13 @@ module Hakyll.Core.Provider.Tests
88--------------------------------------------------------------------------------
99import Hakyll.Core.Metadata
1010import Hakyll.Core.Provider
11−import Test.Framework (Test, testGroup)
12−import Test.Framework.Providers.HUnit (testCase)
13−import Test.HUnit (Assertion, assert, (@=?))
11+import Test.Tasty (TestTree, testGroup)
12+import Test.Tasty.HUnit (Assertion, assert, testCase, (@=?))
1413import TestSuite.Util
1514
1615
1716--------------------------------------------------------------------------------
18−tests :: Test
17+tests :: TestTree
1918tests = testGroup "Hakyll.Core.Provider.Tests"
2019 [ testCase "case01" case01
2120 ]
tests/Hakyll/Core/Routes/Tests.hs+3−3
@@ -11,13 +11,13 @@ import Hakyll.Core.Identifier
1111import Hakyll.Core.Metadata
1212import Hakyll.Core.Routes
1313import System.FilePath ((</>))
14−import Test.Framework (Test, testGroup)
15−import Test.HUnit (Assertion, (@=?))
14+import Test.Tasty (TestTree, testGroup)
15+import Test.Tasty.HUnit (Assertion, (@=?))
1616import TestSuite.Util
1717
1818
1919--------------------------------------------------------------------------------
20−tests :: Test
20+tests :: TestTree
2121tests = testGroup "Hakyll.Core.Routes.Tests" $ fromAssertions "runRoutes"
2222 [ testRoutes "foo.html" (setExtension "html") "foo"
2323 , testRoutes "foo.html" (setExtension ".html") "foo"
tests/Hakyll/Core/Rules/Tests.hs+3−3
@@ -19,13 +19,13 @@ import Hakyll.Core.Rules
1919import Hakyll.Core.Rules.Internal
2020import Hakyll.Web.Pandoc
2121import System.FilePath ((</>))
22−import Test.Framework (Test, testGroup)
23−import Test.HUnit (Assertion, assert, (@=?))
22+import Test.Tasty (TestTree, testGroup)
23+import Test.Tasty.HUnit (Assertion, assert, (@=?))
2424import TestSuite.Util
2525
2626
2727--------------------------------------------------------------------------------
28−tests :: Test
28+tests :: TestTree
2929tests = testGroup "Hakyll.Core.Rules.Tests" $ fromAssertions "runRules"
3030 [case01]
3131
tests/Hakyll/Core/Runtime/Tests.hs+3−3
@@ -8,8 +8,8 @@ module Hakyll.Core.Runtime.Tests
88--------------------------------------------------------------------------------
99import qualified Data.ByteString as B
1010import System.FilePath ((</>))
11−import Test.Framework (Test, testGroup)
12−import Test.HUnit (Assertion, (@?=))
11+import Test.Tasty (TestTree, testGroup)
12+import Test.Tasty.HUnit (Assertion, (@?=))
1313
1414
1515--------------------------------------------------------------------------------
@@ -20,7 +20,7 @@ import TestSuite.Util
2020
2121
2222--------------------------------------------------------------------------------
23−tests :: Test
23+tests :: TestTree
2424tests = testGroup "Hakyll.Core.Runtime.Tests" $
2525 fromAssertions "run" [case01, case02]
2626
tests/Hakyll/Core/Store/Tests.hs+9−9
@@ -6,22 +6,22 @@ module Hakyll.Core.Store.Tests
66
77
88--------------------------------------------------------------------------------
9−import Data.Typeable (typeOf)
10−import Test.Framework (Test, testGroup)
11−import Test.Framework.Providers.HUnit (testCase)
12−import Test.Framework.Providers.QuickCheck2 (testProperty)
13−import qualified Test.HUnit as H
14−import qualified Test.QuickCheck as Q
15−import qualified Test.QuickCheck.Monadic as Q
9+import Data.Typeable (typeOf)
10+import qualified Test.QuickCheck as Q
11+import qualified Test.QuickCheck.Monadic as Q
12+import Test.Tasty (TestTree, testGroup)
13+import Test.Tasty.HUnit (testCase)
14+import qualified Test.Tasty.HUnit as H
15+import Test.Tasty.QuickCheck (testProperty)
1616
1717
1818--------------------------------------------------------------------------------
19−import qualified Hakyll.Core.Store as Store
19+import qualified Hakyll.Core.Store as Store
2020import TestSuite.Util
2121
2222
2323--------------------------------------------------------------------------------
24−tests :: Test
24+tests :: TestTree
2525tests = testGroup "Hakyll.Core.Store.Tests"
2626 [ testProperty "simple get . set" simpleSetGet
2727 , testProperty "persistent get . set" persistentSetGet
tests/Hakyll/Core/UnixFilter/Tests.hs+5−5
@@ -6,10 +6,10 @@ module Hakyll.Core.UnixFilter.Tests
66
77
88--------------------------------------------------------------------------------
9−import Data.List (isInfixOf)
10−import Test.Framework (Test, testGroup)
11−import Test.Framework.Providers.HUnit (testCase)
12−import qualified Test.HUnit as H
9+import Data.List (isInfixOf)
10+import Test.Tasty (TestTree, testGroup)
11+import Test.Tasty.HUnit (testCase)
12+import qualified Test.Tasty.HUnit as H
1313
1414
1515--------------------------------------------------------------------------------
@@ -21,7 +21,7 @@ import TestSuite.Util
2121
2222
2323--------------------------------------------------------------------------------
24−tests :: Test
24+tests :: TestTree
2525tests = testGroup "Hakyll.Core.UnixFilter.Tests"
2626 [ testCase "unixFilter rev" unixFilterRev
2727 , testCase "unixFilter false" unixFilterFalse
tests/Hakyll/Core/Util/String/Tests.hs+3−3
@@ -5,8 +5,8 @@ module Hakyll.Core.Util.String.Tests
55
66
77--------------------------------------------------------------------------------
8−import Test.Framework (Test, testGroup)
9−import Test.HUnit ((@=?))
8+import Test.Tasty (TestTree, testGroup)
9+import Test.Tasty.HUnit ((@=?))
1010
1111
1212--------------------------------------------------------------------------------
@@ -15,7 +15,7 @@ import TestSuite.Util
1515
1616
1717--------------------------------------------------------------------------------
18−tests :: Test
18+tests :: TestTree
1919tests = testGroup "Hakyll.Core.Util.String.Tests" $ concat
2020 [ fromAssertions "trim"
2121 [ "foo" @=? trim " foo\n\t "
tests/Hakyll/Web/CompressCss/Tests.hs+6−6
@@ -5,9 +5,9 @@ module Hakyll.Web.CompressCss.Tests
55
66
77--------------------------------------------------------------------------------
8−import Data.Char (toUpper)
9−import Test.Framework (Test, testGroup)
10−import Test.HUnit (assert, (@=?))
8+import Data.Char (toUpper)
9+import Test.Tasty (TestTree, testGroup)
10+import Test.Tasty.HUnit (assert, (@=?))
1111
1212
1313--------------------------------------------------------------------------------
@@ -16,10 +16,10 @@ import TestSuite.Util
1616
1717
1818--------------------------------------------------------------------------------
19−tests :: Test
19+tests :: TestTree
2020tests = testGroup "Hakyll.Web.CompressCss.Tests" $ concat
2121 [ fromAssertions "compressCss"
22− [
22+ [
2323 -- compress whitespace
2424 " something something " @=?
2525 compressCss " something \n\t\r something "
@@ -32,7 +32,7 @@ tests = testGroup "Hakyll.Web.CompressCss.Tests" $ concat
3232 -- strip comments
3333 , "before after" @=? compressCss "before /* abc { } ;; \n\t\r */ after"
3434 -- don't strip comments inside constants
35− , "before \"/* abc { } ;; \n\t\r */\" after"
35+ , "before \"/* abc { } ;; \n\t\r */\" after"
3636 @=? compressCss "before \"/* abc { } ;; \n\t\r */\" after"
3737
3838 -- compress separators
tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs+4−3
@@ -6,8 +6,9 @@ module Hakyll.Web.Html.RelativizeUrls.Tests
66
77
88--------------------------------------------------------------------------------
9−import Test.Framework (Test, testGroup)
10−import Test.HUnit ((@=?))
9+import Test.Tasty (TestTree, testGroup)
10+import Test.Tasty.HUnit ((@=?))
11+
1112
1213--------------------------------------------------------------------------------
1314import Hakyll.Web.Html.RelativizeUrls
@@ -15,7 +16,7 @@ import TestSuite.Util
1516
1617
1718--------------------------------------------------------------------------------
18−tests :: Test
19+tests :: TestTree
1920tests = testGroup "Hakyll.Web.Html.RelativizeUrls.Tests" $
2021 fromAssertions "relativizeUrls"
2122 [ "<a href=\"../foo\">bar</a>" @=?
tests/Hakyll/Web/Html/Tests.hs+4−4
@@ -5,9 +5,9 @@ module Hakyll.Web.Html.Tests
55
66
77--------------------------------------------------------------------------------
8−import Data.Char (toUpper)
9−import Test.Framework (Test, testGroup)
10−import Test.HUnit (assert, (@=?))
8+import Data.Char (toUpper)
9+import Test.Tasty (TestTree, testGroup)
10+import Test.Tasty.HUnit (assert, (@=?))
1111
1212
1313--------------------------------------------------------------------------------
@@ -16,7 +16,7 @@ import TestSuite.Util
1616
1717
1818--------------------------------------------------------------------------------
19−tests :: Test
19+tests :: TestTree
2020tests = testGroup "Hakyll.Web.Html.Tests" $ concat
2121 [ fromAssertions "demoteHeaders"
2222 [ "<h2>A h1 title</h2>" @=?
tests/Hakyll/Web/Pandoc/FileType/Tests.hs+3−3
@@ -6,8 +6,8 @@ module Hakyll.Web.Pandoc.FileType.Tests
66
77
88--------------------------------------------------------------------------------
9−import Test.Framework (Test, testGroup)
10−import Test.HUnit ((@=?))
9+import Test.Tasty (TestTree, testGroup)
10+import Test.Tasty.HUnit ((@=?))
1111
1212
1313--------------------------------------------------------------------------------
@@ -16,7 +16,7 @@ import TestSuite.Util
1616
1717
1818--------------------------------------------------------------------------------
19−tests :: Test
19+tests :: TestTree
2020tests = testGroup "Hakyll.Web.Pandoc.FileType.Tests" $
2121 fromAssertions "fileType"
2222 [ Markdown @=? fileType "index.md"
tests/Hakyll/Web/Template/Context/Tests.hs+4−5
@@ -6,22 +6,21 @@ module Hakyll.Web.Template.Context.Tests
66
77
88--------------------------------------------------------------------------------
9−import Test.Framework (Test, testGroup)
10−import Test.Framework.Providers.HUnit (testCase)
11−import Test.HUnit (Assertion, (@=?))
9+import Test.Tasty (TestTree, testGroup)
10+import Test.Tasty.HUnit (Assertion, testCase, (@=?))
1211
1312
1413--------------------------------------------------------------------------------
1514import Hakyll.Core.Compiler
1615import Hakyll.Core.Identifier
1716import Hakyll.Core.Provider
18−import Hakyll.Core.Store (Store)
17+import Hakyll.Core.Store (Store)
1918import Hakyll.Web.Template.Context
2019import TestSuite.Util
2120
2221
2322--------------------------------------------------------------------------------
24−tests :: Test
23+tests :: TestTree
2524tests = testGroup "Hakyll.Core.Template.Context.Tests"
2625 [ testCase "testDateField" testDateField
2726 ]
tests/Hakyll/Web/Template/Tests.hs+4−4
@@ -6,9 +6,9 @@ module Hakyll.Web.Template.Tests
66
77
88--------------------------------------------------------------------------------
9−import Test.Framework (Test, testGroup)
10−import Test.Framework.Providers.HUnit (testCase)
11−import Test.HUnit (Assertion, (@=?), (@?=))
9+import Test.Tasty (TestTree, testGroup)
10+import Test.Tasty.HUnit (Assertion, testCase, (@=?),
11+ (@?=))
1212
1313
1414--------------------------------------------------------------------------------
@@ -25,7 +25,7 @@ import TestSuite.Util
2525
2626
2727--------------------------------------------------------------------------------
28−tests :: Test
28+tests :: TestTree
2929tests = testGroup "Hakyll.Core.Template.Tests" $ concat
3030 [ [ testCase "case01" $ test ("template.html.out", "template.html", "example.md")
3131 , testCase "case02" $ test ("strip.html.out", "strip.html", "example.md")
tests/TestSuite.hs+2−2
@@ -5,7 +5,7 @@ module Main
55
66
77--------------------------------------------------------------------------------
8−import Test.Framework (defaultMain)
8+import Test.Tasty (defaultMain, testGroup)
99
1010
1111--------------------------------------------------------------------------------
@@ -29,7 +29,7 @@ import qualified Hakyll.Web.Template.Tests
2929
3030--------------------------------------------------------------------------------
3131main :: IO ()
32−main = defaultMain
32+main = defaultMain $ testGroup "Hakyll"
3333 [ Hakyll.Core.Dependencies.Tests.tests
3434 , Hakyll.Core.Identifier.Tests.tests
3535 , Hakyll.Core.Provider.Metadata.Tests.tests
tests/TestSuite/Util.hs+10−11
@@ -12,30 +12,29 @@ module TestSuite.Util
1212
1313
1414--------------------------------------------------------------------------------
15−import Data.List (intercalate)
16−import Data.Monoid (mempty)
17−import qualified Data.Set as S
18−import Test.Framework
19−import Test.Framework.Providers.HUnit
20−import Test.HUnit hiding (Test)
21−import Text.Printf (printf)
15+import Data.List (intercalate)
16+import Data.Monoid (mempty)
17+import qualified Data.Set as S
18+import Test.Tasty
19+import Test.Tasty.HUnit
20+import Text.Printf (printf)
2221
2322
2423--------------------------------------------------------------------------------
2524import Hakyll.Core.Compiler.Internal
2625import Hakyll.Core.Configuration
2726import Hakyll.Core.Identifier
28−import qualified Hakyll.Core.Logger as Logger
27+import qualified Hakyll.Core.Logger as Logger
2928import Hakyll.Core.Provider
30−import Hakyll.Core.Store (Store)
31−import qualified Hakyll.Core.Store as Store
29+import Hakyll.Core.Store (Store)
30+import qualified Hakyll.Core.Store as Store
3231import Hakyll.Core.Util.File
3332
3433
3534--------------------------------------------------------------------------------
3635fromAssertions :: String -- ^ Name
3736 -> [Assertion] -- ^ Cases
38− -> [Test] -- ^ Result tests
37+ -> [TestTree] -- ^ Result tests
3938fromAssertions name =
4039 zipWith testCase [printf "[%2d] %s" n name | n <- [1 :: Int ..]]
4140