{-# LANGUAGE ScopedTypeVariables #-}
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 a -> Spec
roundtripAndGoldenSpecs proxy :: Proxy a
proxy =
Settings -> Proxy a -> Spec
forall a.
(Arbitrary a, ToJSON a, FromJSON a, Typeable a) =>
Settings -> Proxy a -> Spec
roundtripAndGoldenSpecsWithSettings Settings
defaultSettings Proxy a
proxy
roundtripAndGoldenSpecsWithSettings :: forall a.
(Arbitrary a, ToJSON a, FromJSON a, Typeable a)
=> Settings -> Proxy a -> Spec
roundtripAndGoldenSpecsWithSettings :: Settings -> Proxy a -> Spec
roundtripAndGoldenSpecsWithSettings settings :: Settings
settings proxy :: Proxy a
proxy = do
Proxy a -> Spec
forall a.
(Typeable a, Arbitrary a, ToJSON a, FromJSON a) =>
Proxy a -> Spec
roundtripSpecs Proxy a
proxy
Settings -> Proxy a -> Spec
forall a.
(Typeable a, Arbitrary a, ToJSON a, FromJSON a) =>
Settings -> Proxy a -> Spec
goldenSpecs Settings
settings Proxy a
proxy
roundtripAndGoldenADTSpecs :: forall a.
(Arbitrary a, ToADTArbitrary a, Eq a, Show a, ToJSON a, FromJSON a)
=> Proxy a -> Spec
roundtripAndGoldenADTSpecs :: Proxy a -> Spec
roundtripAndGoldenADTSpecs proxy :: Proxy a
proxy =
Settings -> Proxy a -> Spec
forall a.
(Arbitrary a, ToADTArbitrary a, Eq a, Show a, ToJSON a,
FromJSON a) =>
Settings -> Proxy a -> Spec
roundtripAndGoldenADTSpecsWithSettings Settings
defaultSettings Proxy a
proxy
roundtripAndGoldenADTSpecsWithSettings :: forall a.
(Arbitrary a, ToADTArbitrary a, Eq a, Show a, ToJSON a, FromJSON a)
=> Settings -> Proxy a -> Spec
roundtripAndGoldenADTSpecsWithSettings :: Settings -> Proxy a -> Spec
roundtripAndGoldenADTSpecsWithSettings settings :: Settings
settings proxy :: Proxy a
proxy = do
Proxy a -> Spec
forall a.
(Arbitrary a, ToADTArbitrary a, Eq a, Show a, ToJSON a,
FromJSON a) =>
Proxy a -> Spec
roundtripADTSpecs Proxy a
proxy
Settings -> Proxy a -> Spec
forall a.
(ToADTArbitrary a, Eq a, Show a, ToJSON a, FromJSON a) =>
Settings -> Proxy a -> Spec
goldenADTSpecs Settings
settings Proxy a
proxy