module Test.Aeson.GenericSpecs
(
goldenSpecs
, roundtripSpecs
, roundtripAndGoldenSpecs
, goldenADTSpecs
, roundtripADTSpecs
, roundtripAndGoldenSpecsWithSettings
, roundtripAndGoldenADTSpecs
, roundtripAndGoldenADTSpecsWithSettings
, mkGoldenFileForType
, shouldBeIdentity
, GoldenDirectoryOption(..)
, Settings(..)
, defaultSettings
, Proxy(..)
) where
import Data.Aeson (FromJSON, ToJSON)
import Data.Proxy
import Data.Typeable
import Test.Aeson.Internal.ADT.GoldenSpecs (goldenADTSpecs, mkGoldenFileForType)
import Test.Aeson.Internal.ADT.RoundtripSpecs (roundtripADTSpecs)
import Test.Aeson.Internal.GoldenSpecs (goldenSpecs)
import Test.Aeson.Internal.RoundtripSpecs (roundtripSpecs)
import Test.Aeson.Internal.Utils
import Test.Hspec
import Test.QuickCheck
import Test.QuickCheck.Arbitrary.ADT
roundtripAndGoldenSpecs :: forall a.
(Arbitrary a, ToJSON a, FromJSON a, Typeable a)
=> Proxy a -> Spec
roundtripAndGoldenSpecs proxy =
roundtripAndGoldenSpecsWithSettings defaultSettings proxy
roundtripAndGoldenSpecsWithSettings :: forall a.
(Arbitrary a, ToJSON a, FromJSON a, Typeable a)
=> Settings -> Proxy a -> Spec
roundtripAndGoldenSpecsWithSettings settings proxy = do
roundtripSpecs proxy
goldenSpecs settings proxy
roundtripAndGoldenADTSpecs :: forall a.
(ToADTArbitrary a, Eq a, Show a, ToJSON a, FromJSON a)
=> Proxy a -> Spec
roundtripAndGoldenADTSpecs proxy =
roundtripAndGoldenADTSpecsWithSettings defaultSettings proxy
roundtripAndGoldenADTSpecsWithSettings :: forall a.
(ToADTArbitrary a, Eq a, Show a, ToJSON a, FromJSON a)
=> Settings -> Proxy a -> Spec
roundtripAndGoldenADTSpecsWithSettings settings proxy = do
roundtripADTSpecs proxy
goldenADTSpecs settings proxy