| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Test.Hspec.Expectations.Json.Internal
Description
Internal building-blocks for JSON Value expectations
Synopsis
- assertBoolWithDiff :: HasCallStack => Bool -> Text -> Text -> IO ()
- newtype Superset = Superset Value
- newtype Subset = Subset Value
- pruneJson :: Superset -> Subset -> Value
- newtype Sortable = Sortable Value
- sortJsonArrays :: Value -> Value
- vectorSortOn :: Ord b => (a -> b) -> Vector a -> Vector a
- normalizeScientific :: Value -> Value
- filterNullFields :: Value -> Value
- expandHeterogenousArrays :: Value -> Value
Pretty diff
assertBoolWithDiff :: HasCallStack => Bool -> Text -> Text -> IO () Source #
Pruning Values
Sorting Values
sortJsonArrays :: Value -> Value 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.
filterNullFields :: Value -> Value Source #
expandHeterogenousArrays :: Value -> Value Source #
Expand objects in arrays to have null values for omitted fields
ex: [{a:1}, {b:1}] -> [{a:1, b:null}, {a:null, b:1}]