Skip to content

Commit b816c73

Browse files
authored
Merge pull request #634 from Lysxia/switch-tasty
Switch to tasty
2 parents 2090406 + afcb867 commit b816c73

File tree

10 files changed

+28
-30
lines changed

10 files changed

+28
-30
lines changed

aeson.cabal

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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
1716
flags:
1817
flags:

stack-lts7.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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
1312
flags:
1413
aeson:

stack-lts8.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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
1110
flags:
1211
aeson:
1312
fast: true

tests/DataFamilies/Properties.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import DataFamilies.Encoders
99
import DataFamilies.Instances ()
1010
import 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
1818
tests = testGroup "data families" [
1919
testGroup "template-haskell" [
2020
testGroup "toJSON" [

tests/ErrorMessages.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import Data.Aeson (FromJSON(..), eitherDecode)
1313
import Data.Proxy (Proxy(..))
1414
import Instances ()
1515
import 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)
1818
import Test.HUnit (Assertion, assertFailure, assertEqual)
1919
import qualified Data.ByteString.Lazy.Char8 as L
2020
import qualified Data.HashMap.Strict as HM
2121

22-
tests :: [Test]
22+
tests :: [TestTree]
2323
tests =
2424
[
2525
testCase "Int" int

tests/Properties.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ import Data.Version (Version)
3333
import Encoders
3434
import Instances ()
3535
import 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)
3838
import Test.QuickCheck (Arbitrary(..), Property, Testable, (===), (.&&.), counterexample)
3939
import Types
4040
import qualified Data.Attoparsec.Lazy as L
@@ -228,7 +228,7 @@ isEmptyArray' = (Array mempty ==)
228228
--------------------------------------------------------------------------------
229229

230230

231-
tests :: Test
231+
tests :: TestTree
232232
tests = testGroup "properties" [
233233
testGroup "encode" [
234234
testProperty "encodeDouble" encodeDouble

tests/SerializationFormatSpec.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ import Data.Time (fromGregorian)
3535
import Data.Word (Word8)
3636
import GHC.Generics (Generic)
3737
import 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)
4040
import Test.HUnit (assertFailure, assertEqual)
4141
import Types (Approx(..), Compose3, Compose3', I)
4242
import qualified Data.ByteString.Lazy.Char8 as L
@@ -54,7 +54,7 @@ import qualified Data.Tree as Tree
5454
import qualified Data.UUID.Types as UUID
5555
import qualified Data.Vector as Vector
5656

57-
tests :: [Test]
57+
tests :: [TestTree]
5858
tests =
5959
[
6060
testGroup "To JSON representation" $ fmap assertJsonEncodingExample jsonEncodingExamples
@@ -246,7 +246,7 @@ instance (ToJSON a, ToJSON b) => ToJSON (MyEither a b) where
246246
instance (FromJSON a, FromJSON b) => FromJSON (MyEither a b) where
247247
parseJSON = genericParseJSON defaultOptions { sumEncoding = UntaggedValue }
248248

249-
assertJsonExample :: Example -> Test
249+
assertJsonExample :: Example -> TestTree
250250
assertJsonExample (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
255255
assertJsonExample (MaybeExample name bs mval) = testCase name $
256256
assertEqual "decode" mval (decode bs)
257257

258-
assertJsonEncodingExample :: Example -> Test
258+
assertJsonEncodingExample :: Example -> TestTree
259259
assertJsonEncodingExample (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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ module Main (main) where
33
import Prelude ()
44
import Prelude.Compat
55

6-
import Test.Framework (defaultMain)
6+
import Test.Tasty (defaultMain, testGroup)
77
import qualified DataFamilies.Properties as DF
88
import qualified Properties
99
import qualified UnitTests
1010

1111
main :: IO ()
1212
main = 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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ import GHC.Generics (Generic)
4343
import Instances ()
4444
import System.Directory (getDirectoryContents)
4545
import 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)
4848
import Test.HUnit (Assertion, assertBool, assertFailure, assertEqual)
4949
import Text.Printf (printf)
5050
import UnitTests.NullaryConstructors (nullaryConstructors)
@@ -62,7 +62,7 @@ import qualified SerializationFormatSpec
6262
import Data.Aeson.Parser.UnescapeFFI ()
6363
import Data.Aeson.Parser.UnescapePure ()
6464

65-
tests :: Test
65+
tests :: TestTree
6666
tests = 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]
350350
ioTests = do
351351
enc <- encoderComparisonTests
352352
js <- jsonTestSuite
353353
return [enc, js]
354354

355-
encoderComparisonTests :: IO Test
355+
encoderComparisonTests :: IO TestTree
356356
encoderComparisonTests = 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
416416
jsonTestSuiteTest 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
431431
jsonTestSuite = do
432432
let suitePath = "tests/JSONTestSuite"
433433
let suites = ["test_parsing", "test_transform"]
@@ -508,7 +508,7 @@ showOptions =
508508
newtype SingleMaybeField = SingleMaybeField { smf :: Maybe Int }
509509
deriving (Eq, Show, Generic)
510510

511-
singleMaybeField :: [Test]
511+
singleMaybeField :: [TestTree]
512512
singleMaybeField = do
513513
(gName, gToJSON, gToEncoding, gFromJSON) <-
514514
[ ("generic", genericToJSON opts, genericToEncoding opts, parse (genericParseJSON opts))

0 commit comments

Comments
 (0)