sandwich-0.2.2.0: Yet another test framework for Haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Sandwich.Golden

Synopsis

Main test function

golden :: (MonadIO m, MonadThrow m, Eq str, Show str) => Golden str -> Free (SpecCommand context m) () Source #

Runs a Golden test.

Built-in Goldens.

goldenText :: String -> Text -> Golden Text Source #

Golden for a Text.

goldenString :: String -> String -> Golden String Source #

Golden for a Value.

goldenJSON :: (ToJSON a, FromJSON a) => String -> a -> Golden a Source #

Golden for an Aeson value (ToJSON/FromJSON).

goldenShowable :: (Show a, Read a) => String -> a -> Golden a Source #

Golden for a general Show/Read type.

mkGolden :: (FilePath -> a -> IO ()) -> (FilePath -> IO a) -> String -> a -> Golden a Source #

Make your own Golden constructor by providing goldenWriteToFile and goldenReadFromFile.

Parameters for a Golden.

goldenOutput :: Golden a -> a Source #

Expected output.

goldenWriteToFile :: Golden a -> FilePath -> a -> IO () Source #

How to write into the golden file the file.

goldenReadFromFile :: Golden a -> FilePath -> IO a Source #

How to read the file.

goldenFile :: Golden a -> FilePath Source #

Where to read/write the golden file for this test.

goldenActualFile :: Golden a -> Maybe FilePath Source #

Where to save the actual file for this test. If it is Nothing then no file is written.

goldenFailFirstTime :: Golden a -> Bool Source #

Whether to record a failure the first time this test is run.