Safe Haskell | None |
---|---|
Language | Haskell2010 |
- roundtripSpecs :: forall a. (Typeable a, Eq a, Show a, Arbitrary a, ToJSON a, FromJSON a) => Proxy a -> Spec
- goldenSpecs :: (Eq a, Show a, Typeable a, Arbitrary a, ToJSON a, FromJSON a) => Proxy a -> Spec
- shouldBeIdentity :: (Eq a, Show a, Arbitrary a) => Proxy a -> (a -> IO a) -> Property
- data Proxy k t :: forall k. k -> * = Proxy
Documentation
roundtripSpecs :: forall a. (Typeable a, Eq a, Show a, Arbitrary a, ToJSON a, FromJSON a) => Proxy a -> Spec Source #
Allows to obtain a roundtrip test to check whether values of the given type can be successfully converted to JSON and back.
roundtripSpecs
will
goldenSpecs :: (Eq a, Show a, Typeable a, Arbitrary a, ToJSON a, FromJSON a) => Proxy a -> Spec Source #
Allows to obtain tests that will try to ensure that the JSON encoding
didn't change unintentionally. To this end goldenSpecs
will
- write a file
golden.json/TYPENAME.json
in the current directory containing a number of JSON-encoded sample values, - during subsequent tests it will encode the same sample values again and compare them with the saved golden encodings,
- on failure it will create a file
golden.json/TYPENAME.faulty.json
for easy manual inspection.
You can consider putting the golden files under revision control. That way it'll be obvious when JSON encodings change.
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.
re-exports
data Proxy k t :: forall k. k -> * #
A concrete, poly-kinded proxy type
Monad (Proxy *) | |
Functor (Proxy *) | |
Applicative (Proxy *) | |
Foldable (Proxy *) | |
Generic1 (Proxy *) | |
Alternative (Proxy *) | |
MonadPlus (Proxy *) | |
Eq1 (Proxy *) | Since: 4.9.0.0 |
Ord1 (Proxy *) | Since: 4.9.0.0 |
Read1 (Proxy *) | Since: 4.9.0.0 |
Show1 (Proxy *) | Since: 4.9.0.0 |
Bounded (Proxy k s) | |
Enum (Proxy k s) | |
Eq (Proxy k s) | |
Ord (Proxy k s) | |
Read (Proxy k s) | |
Show (Proxy k s) | |
Ix (Proxy k s) | |
Generic (Proxy k t) | |
Semigroup (Proxy k s) | |
Monoid (Proxy k s) | |
type Rep1 (Proxy *) | |
type Rep (Proxy k t) | |