Safe Haskell | None |
---|---|
Language | Haskell2010 |
- goldenSpecs :: (Eq a, Show a, Typeable a, Arbitrary a, ToJSON a, FromJSON a) => Proxy a -> Spec
- goldenSpecsWithNote :: (Eq a, Show a, Typeable a, Arbitrary a, ToJSON a, FromJSON a) => Proxy a -> Maybe String -> Spec
- mkGoldenFile :: Typeable a => Proxy a -> FilePath
- mkFaultyFile :: Typeable a => Proxy a -> FilePath
- createGoldenfile :: forall a. (Show a, Arbitrary a, ToJSON a) => Proxy a -> FilePath -> IO ()
- setSeed :: Int -> Gen a -> Gen a
- compareWithGolden :: forall a. (Eq a, Show a, Typeable a, Arbitrary a, ToJSON a, FromJSON a) => Proxy a -> FilePath -> IO ()
- readSeed :: ByteString -> IO Int
- data RandomSamples a = RandomSamples {}
- mkRandomSamples :: forall a. Arbitrary a => Proxy a -> Int -> IO (RandomSamples a)
Documentation
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.
goldenSpecsWithNote :: (Eq a, Show a, Typeable a, Arbitrary a, ToJSON a, FromJSON a) => Proxy a -> Maybe String -> Spec Source #
createGoldenfile :: forall a. (Show a, Arbitrary a, ToJSON a) => Proxy a -> FilePath -> IO () Source #
compareWithGolden :: forall a. (Eq a, Show a, Typeable a, Arbitrary a, ToJSON a, FromJSON a) => Proxy a -> FilePath -> IO () Source #
RandomSamples
data RandomSamples a Source #
Eq a => Eq (RandomSamples a) Source # | |
Ord a => Ord (RandomSamples a) Source # | |
Show a => Show (RandomSamples a) Source # | |
Generic (RandomSamples a) Source # | |
ToJSON a => ToJSON (RandomSamples a) Source # | |
FromJSON a => FromJSON (RandomSamples a) Source # | |
type Rep (RandomSamples a) Source # | |
mkRandomSamples :: forall a. Arbitrary a => Proxy a -> Int -> IO (RandomSamples a) Source #