hspec-golden-aeson-0.9.0.0: Use tests to monitor changes in Aeson serialization
Copyright(c) Plow Technologies 2016
LicenseBSD3
Maintainermchaver@gmail.com
StabilityBeta
Safe HaskellNone
LanguageHaskell2010

Test.Aeson.Internal.Utils

Description

 
Synopsis

Documentation

data ComparisonFile Source #

Option to indicate whether to create a separate comparison file or overwrite the golden file. A separate file allows you to use diff to compare. Overwriting allows you to use source control tools for comparison.

Constructors

FaultyFile

Create a new faulty file when tests fail

OverwriteGoldenFile

Overwrite the golden file when tests fail

data RandomMismatchOption Source #

Option indicating whether to fail tests when the random seed does not produce the same values as in the golden file. Default is to output a warning.

Constructors

RandomMismatchWarning

Only output a warning when the random seed does not produce the same values

RandomMismatchError

Fail the test when the random seed does not produce the same value

data Settings Source #

Constructors

Settings 

Fields

data GoldenDirectoryOption Source #

A custom directory name or a preselected directory name.

Constructors

CustomDirectoryName String 
GoldenDirectory 

defaultSettings :: Settings Source #

The default settings for general use cases.

addBrackets :: String -> String Source #

put brackets around a String.

shouldBeIdentity :: (Eq a, Show a, Arbitrary a) => Proxy a -> (a -> IO a) -> Property Source #

hspec style combinator to easily write tests that check the a given operation returns the same value it was given, e.g. roundtrip tests.

checkAesonEncodingEquality :: forall a. (ToJSON a, FromJSON a) => JsonShow a -> Bool Source #

This function will compare one JSON encoding to a subsequent JSON encoding, thus eliminating the need for an Eq instance

aesonDecodeIO :: FromJSON a => ByteString -> IO a Source #

run decode in IO, if it returns Left then throw an error.

data AesonDecodeError Source #

Constructors

AesonDecodeError String 

Instances

Instances details
Eq AesonDecodeError Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Show AesonDecodeError Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

showsPrec :: Int -> AesonDecodeError -> ShowS

show :: AesonDecodeError -> String

showList :: [AesonDecodeError] -> ShowS

Exception AesonDecodeError Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

toException :: AesonDecodeError -> SomeException

fromException :: SomeException -> Maybe AesonDecodeError

displayException :: AesonDecodeError -> String

newtype JsonShow a Source #

Used to eliminate the need for an Eq instance

Constructors

JsonShow a 

Instances

Instances details
ToJSON a => Show (JsonShow a) Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

showsPrec :: Int -> JsonShow a -> ShowS

show :: JsonShow a -> String

showList :: [JsonShow a] -> ShowS

FromJSON a => FromJSON (JsonShow a) Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

parseJSON :: Value -> Parser (JsonShow a)

parseJSONList :: Value -> Parser [JsonShow a]

ToJSON a => ToJSON (JsonShow a) Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

toJSON :: JsonShow a -> Value

toEncoding :: JsonShow a -> Encoding

toJSONList :: [JsonShow a] -> Value

toEncodingList :: [JsonShow a] -> Encoding

Arbitrary a => Arbitrary (JsonShow a) Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

arbitrary :: Gen (JsonShow a)

shrink :: JsonShow a -> [JsonShow a]

newtype TopDir Source #

Constructors

TopDir 

Fields

Instances

Instances details
Eq TopDir Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

(==) :: TopDir -> TopDir -> Bool

(/=) :: TopDir -> TopDir -> Bool

Read TopDir Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

readsPrec :: Int -> ReadS TopDir

readList :: ReadS [TopDir]

readPrec :: ReadPrec TopDir

readListPrec :: ReadPrec [TopDir]

Show TopDir Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

showsPrec :: Int -> TopDir -> ShowS

show :: TopDir -> String

showList :: [TopDir] -> ShowS

newtype ModuleName Source #

Constructors

ModuleName 

Fields

Instances

Instances details
Eq ModuleName Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

(==) :: ModuleName -> ModuleName -> Bool

(/=) :: ModuleName -> ModuleName -> Bool

Read ModuleName Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

readsPrec :: Int -> ReadS ModuleName

readList :: ReadS [ModuleName]

readPrec :: ReadPrec ModuleName

readListPrec :: ReadPrec [ModuleName]

Show ModuleName Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

showsPrec :: Int -> ModuleName -> ShowS

show :: ModuleName -> String

showList :: [ModuleName] -> ShowS

newtype TypeName Source #

Constructors

TypeName 

Fields

Instances

Instances details
Eq TypeName Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

(==) :: TypeName -> TypeName -> Bool

(/=) :: TypeName -> TypeName -> Bool

Read TypeName Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

readsPrec :: Int -> ReadS TypeName

readList :: ReadS [TypeName]

readPrec :: ReadPrec TypeName

readListPrec :: ReadPrec [TypeName]

Show TypeName Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

showsPrec :: Int -> TypeName -> ShowS

show :: TypeName -> String

showList :: [TypeName] -> ShowS

data TypeNameInfo a Source #

Instances

Instances details
Eq (TypeNameInfo a) Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

(==) :: TypeNameInfo a -> TypeNameInfo a -> Bool

(/=) :: TypeNameInfo a -> TypeNameInfo a -> Bool

Read (TypeNameInfo a) Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

readsPrec :: Int -> ReadS (TypeNameInfo a)

readList :: ReadS [TypeNameInfo a]

readPrec :: ReadPrec (TypeNameInfo a)

readListPrec :: ReadPrec [TypeNameInfo a]

Show (TypeNameInfo a) Source # 
Instance details

Defined in Test.Aeson.Internal.Utils

Methods

showsPrec :: Int -> TypeNameInfo a -> ShowS

show :: TypeNameInfo a -> String

showList :: [TypeNameInfo a] -> ShowS

mkTypeNameInfo :: forall a. Arbitrary a => Typeable a => Settings -> Proxy a -> IO (TypeNameInfo a) Source #

encodePrettySortedKeys :: ToJSON a => a -> ByteString Source #