on master help sign in
Merge pull request #634 from Lysxia/switch-tasty

Switch to tasty

commitb816c730bfded70dbfad5ab9747728bbe2202ea5 authorAdam Bergmark <adam@bergmark.nl> dateMon 23 Apr 2018, 21:31 (8 years ago) parent2090406afcb867
10 files changed+28−30
aeson.cabal+3−3 stack-lts6.yaml−1 stack-lts7.yaml−1 stack-lts8.yaml−1 tests/DataFamilies/Properties.hs+3−3 tests/ErrorMessages.hs+3−3 tests/Properties.hs+3−3 tests/SerializationFormatSpec.hs+5−5 tests/Tests.hs+3−2 tests/UnitTests.hs+8−8
aeson.cabal+3−3
@@ -204,9 +204,9 @@ test-suite tests
204204 scientific,
205205 tagged,
206206 template-haskell,
207− test-framework,
208− test-framework-hunit,
209− test-framework-quickcheck2,
207+ tasty,
208+ tasty-hunit,
209+ tasty-quickcheck,
210210 text,
211211 time,
212212 time-locale-compat,
stack-lts6.yaml−1
@@ -12,7 +12,6 @@ extra-deps:
1212- hashable-1.2.6.1
1313- integer-logarithms-1
1414- quickcheck-instances-0.3.16
15−- test-framework-quickcheck2-0.3.0.4
1615- th-abstraction-0.2.2.0
1716flags:
1817flags:
stack-lts7.yaml−1
@@ -8,7 +8,6 @@ extra-deps:
88- hashable-1.2.6.1
99- integer-logarithms-1
1010- quickcheck-instances-0.3.16
11−- test-framework-quickcheck2-0.3.0.4
1211- th-abstraction-0.2.2.0
1312flags:
1413 aeson:
stack-lts8.yaml−1
@@ -7,7 +7,6 @@ extra-deps:
77- base-compat-0.9.3
88- quickcheck-instances-0.3.16
99- th-abstraction-0.2.2.0
10−- test-framework-quickcheck2-0.3.0.4
1110flags:
1211 aeson:
1312 fast: true
tests/DataFamilies/Properties.hs+3−3
@@ -9,12 +9,12 @@ import DataFamilies.Encoders
99import DataFamilies.Instances ()
1010import Properties hiding (tests)
1111
12−import Test.Framework (Test, testGroup)
13−import Test.Framework.Providers.QuickCheck2 (testProperty)
12+import Test.Tasty (TestTree, testGroup)
13+import Test.Tasty.QuickCheck (testProperty)
1414
1515--------------------------------------------------------------------------------
1616
17−tests :: Test
17+tests :: TestTree
1818tests = testGroup "data families" [
1919 testGroup "template-haskell" [
2020 testGroup "toJSON" [
tests/ErrorMessages.hs+3−3
@@ -13,13 +13,13 @@ import Data.Aeson (FromJSON(..), eitherDecode)
1313import Data.Proxy (Proxy(..))
1414import Instances ()
1515import Numeric.Natural (Natural)
16−import Test.Framework (Test)
17−import Test.Framework.Providers.HUnit (testCase)
16+import Test.Tasty (TestTree)
17+import Test.Tasty.HUnit (testCase)
1818import Test.HUnit (Assertion, assertFailure, assertEqual)
1919import qualified Data.ByteString.Lazy.Char8 as L
2020import qualified Data.HashMap.Strict as HM
2121
22−tests :: [Test]
22+tests :: [TestTree]
2323tests =
2424 [
2525 testCase "Int" int
tests/Properties.hs+3−3
@@ -33,8 +33,8 @@ import Data.Version (Version)
3333import Encoders
3434import Instances ()
3535import Numeric.Natural (Natural)
36−import Test.Framework (Test, testGroup)
37−import Test.Framework.Providers.QuickCheck2 (testProperty)
36+import Test.Tasty (TestTree, testGroup)
37+import Test.Tasty.QuickCheck (testProperty)
3838import Test.QuickCheck (Arbitrary(..), Property, Testable, (===), (.&&.), counterexample)
3939import Types
4040import qualified Data.Attoparsec.Lazy as L
@@ -228,7 +228,7 @@ isEmptyArray' = (Array mempty ==)
228228--------------------------------------------------------------------------------
229229
230230
231−tests :: Test
231+tests :: TestTree
232232tests = testGroup "properties" [
233233 testGroup "encode" [
234234 testProperty "encodeDouble" encodeDouble
tests/SerializationFormatSpec.hs+5−5
@@ -35,8 +35,8 @@ import Data.Time (fromGregorian)
3535import Data.Word (Word8)
3636import GHC.Generics (Generic)
3737import Instances ()
38−import Test.Framework (Test, testGroup)
39−import Test.Framework.Providers.HUnit (testCase)
38+import Test.Tasty (TestTree, testGroup)
39+import Test.Tasty.HUnit (testCase)
4040import Test.HUnit (assertFailure, assertEqual)
4141import Types (Approx(..), Compose3, Compose3', I)
4242import qualified Data.ByteString.Lazy.Char8 as L
@@ -54,7 +54,7 @@ import qualified Data.Tree as Tree
5454import qualified Data.UUID.Types as UUID
5555import qualified Data.Vector as Vector
5656
57−tests :: [Test]
57+tests :: [TestTree]
5858tests =
5959 [
6060 testGroup "To JSON representation" $ fmap assertJsonEncodingExample jsonEncodingExamples
@@ -246,7 +246,7 @@ instance (ToJSON a, ToJSON b) => ToJSON (MyEither a b) where
246246instance (FromJSON a, FromJSON b) => FromJSON (MyEither a b) where
247247 parseJSON = genericParseJSON defaultOptions { sumEncoding = UntaggedValue }
248248
249−assertJsonExample :: Example -> Test
249+assertJsonExample :: Example -> TestTree
250250assertJsonExample (Example name bss val) = testCase name $ do
251251 assertSomeEqual "encode" bss (encode val)
252252 assertSomeEqual "encode/via value" bss (encode $ toJSON val)
@@ -255,7 +255,7 @@ assertJsonExample (Example name bss val) = testCase name $ do
255255assertJsonExample (MaybeExample name bs mval) = testCase name $
256256 assertEqual "decode" mval (decode bs)
257257
258−assertJsonEncodingExample :: Example -> Test
258+assertJsonEncodingExample :: Example -> TestTree
259259assertJsonEncodingExample (Example name bss val) = testCase name $ do
260260 assertSomeEqual "encode" bss (encode val)
261261 assertSomeEqual "encode/via value" bss (encode $ toJSON val)
tests/Tests.hs+3−2
@@ -3,7 +3,7 @@ module Main (main) where
33import Prelude ()
44import Prelude.Compat
55
6−import Test.Framework (defaultMain)
6+import Test.Tasty (defaultMain, testGroup)
77import qualified DataFamilies.Properties as DF
88import qualified Properties
99import qualified UnitTests
@@ -11,4 +11,5 @@ import qualified UnitTests
1111main :: IO ()
1212main = do
1313 ioTests <- UnitTests.ioTests
14− defaultMain (DF.tests : Properties.tests : UnitTests.tests : ioTests)
14+ let allTests = DF.tests : Properties.tests : UnitTests.tests : ioTests
15+ defaultMain (testGroup "tests" allTests)
tests/UnitTests.hs+8−8
@@ -43,8 +43,8 @@ import GHC.Generics (Generic)
4343import Instances ()
4444import System.Directory (getDirectoryContents)
4545import System.FilePath ((</>), takeExtension, takeFileName)
46−import Test.Framework (Test, testGroup)
47−import Test.Framework.Providers.HUnit (testCase)
46+import Test.Tasty (TestTree, testGroup)
47+import Test.Tasty.HUnit (testCase)
4848import Test.HUnit (Assertion, assertBool, assertFailure, assertEqual)
4949import Text.Printf (printf)
5050import UnitTests.NullaryConstructors (nullaryConstructors)
@@ -62,7 +62,7 @@ import qualified SerializationFormatSpec
6262import Data.Aeson.Parser.UnescapeFFI ()
6363import Data.Aeson.Parser.UnescapePure ()
6464
65−tests :: Test
65+tests :: TestTree
6666tests = testGroup "unit" [
6767 testGroup "SerializationFormatSpec" SerializationFormatSpec.tests
6868 , testGroup "ErrorMessages" ErrorMessages.tests
@@ -346,13 +346,13 @@ issue351 = [
346346-- Comparison between bytestring and text encoders
347347------------------------------------------------------------------------------
348348
349−ioTests :: IO [Test]
349+ioTests :: IO [TestTree]
350350ioTests = do
351351 enc <- encoderComparisonTests
352352 js <- jsonTestSuite
353353 return [enc, js]
354354
355−encoderComparisonTests :: IO Test
355+encoderComparisonTests :: IO TestTree
356356encoderComparisonTests = do
357357 encoderTests <- forM testFiles $ \file0 -> do
358358 let file = "benchmarks/json-data/" ++ file0
@@ -412,7 +412,7 @@ unescapeString = do
412412
413413-- JSONTestSuite
414414
415−jsonTestSuiteTest :: FilePath -> Test
415+jsonTestSuiteTest :: FilePath -> TestTree
416416jsonTestSuiteTest path = testCase fileName $ do
417417 payload <- L.readFile path
418418 let result = eitherDecode payload :: Either String Value
@@ -427,7 +427,7 @@ jsonTestSuiteTest path = testCase fileName $ do
427427-- Build a collection of tests based on the current contents of the
428428-- JSONTestSuite test directories.
429429
430−jsonTestSuite :: IO Test
430+jsonTestSuite :: IO TestTree
431431jsonTestSuite = do
432432 let suitePath = "tests/JSONTestSuite"
433433 let suites = ["test_parsing", "test_transform"]
@@ -508,7 +508,7 @@ showOptions =
508508newtype SingleMaybeField = SingleMaybeField { smf :: Maybe Int }
509509 deriving (Eq, Show, Generic)
510510
511−singleMaybeField :: [Test]
511+singleMaybeField :: [TestTree]
512512singleMaybeField = do
513513 (gName, gToJSON, gToEncoding, gFromJSON) <-
514514 [ ("generic", genericToJSON opts, genericToEncoding opts, parse (genericParseJSON opts))