hspec-expectations-json-1.0.0.0: Hspec expectations for JSON Values

Safe HaskellNone
LanguageHaskell2010

Test.Hspec.Expectations.Json.Internal

Contents

Description

Internal building-blocks for JSON Value expectations

Synopsis

Pretty diff

Pruning Values

newtype Superset Source #

Constructors

Superset Value 

newtype Subset Source #

Constructors

Subset Value 

pruneJson :: Superset -> Subset -> Value Source #

Recursively remove items in the Superset value not present in Subset

Sorting Values

vectorSortOn :: Ord b => (a -> b) -> Vector a -> Vector a Source #

Dealing with Scientific

normalizeScientific :: Value -> Value Source #

Normalize all Number values to Double precision

Internally, 1 and 1.0 are represented as different values of the Scientific data type. These will compare equally, but if there is some other difference that fails the assertion, they will render as a difference in the message, confusing the reader.

This sends them through an id function as Double, which will make either print as 1.0 consistently.