hspec-expectations-json-1.0.0.7: Hspec expectations for JSON Values
Safe HaskellNone
LanguageHaskell2010

Test.Hspec.Expectations.Json.Internal

Description

Internal building-blocks for JSON Value expectations

Synopsis

Pretty diff

Pruning Objects

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 Arrays

newtype Sortable Source #

Constructors

Sortable Value 

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.