-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Golden tests for hspec
--   
--   Golden tests store the expected output in a separated file. Each time
--   a golden test is executed the output of the subject under test (SUT)
--   is compared with the expected output. If the output of the SUT changes
--   then the test will fail until the expected output is updated.
--   
--   <tt>hspec-golden</tt> allows you to write golden tests using the
--   popular <tt>hspec</tt>.
--   
--   <pre>
--   describe "myFunc" $
--     it "generates the right output with the right params" $
--        let output = show $ myFunc params
--          in defaultGolden "myFunc" output
--   </pre>
--   
--   Please see the <a>README on GitHub</a> for more information.
@package hspec-golden
@version 0.2.2.0


-- | Golden tests store the expected output in a separated file. Each time
--   a golden test is executed the output of the subject under test (SUT)
--   is compared with the expected output. If the output of the SUT changes
--   then the test will fail until the expected output is updated. We
--   expose <a>defaultGolden</a> for output of type <tt>String</tt>. If
--   your SUT has a different output, you can use <a>Golden</a>.
module Test.Hspec.Golden

-- | Golden tests parameters
--   
--   <pre>
--   import           Data.Text (Text)
--   import qualified Data.Text.IO as T
--   
--   goldenText :: String -&gt; Text -&gt; Golden Text
--   goldenText name actualOutput =
--     Golden {
--       output = actualOutput,
--       encodePretty = prettyText,
--       writeToFile = T.writeFile,
--       readFromFile = T.readFile,
--       goldenFile = ".specific-golden-dir" <a>/</a> name <a>/</a> "golden",
--       actualFile = Just (".specific-golden-dir" <a>/</a> name <a>/</a> "actual"),
--       failFirstTime = False
--     }
--   
--   describe "myTextFunc" $
--     it "generates the right output with the right params" $
--       goldenText "myTextFunc" (myTextFunc params)
--   </pre>
data Golden str
Golden :: str -> (str -> String) -> (FilePath -> str -> IO ()) -> (FilePath -> IO str) -> FilePath -> Maybe FilePath -> Bool -> Golden str

-- | Output
[output] :: Golden str -> str

-- | Makes the comparison pretty when the test fails
[encodePretty] :: Golden str -> str -> String

-- | How to write into the golden file the file
[writeToFile] :: Golden str -> FilePath -> str -> IO ()

-- | How to read the file,
[readFromFile] :: Golden str -> FilePath -> IO str

-- | Where to read/write the golden file for this test.
[goldenFile] :: Golden str -> FilePath

-- | Where to save the actual file for this test. If it is <tt>Nothing</tt>
--   then no file is written.
[actualFile] :: Golden str -> Maybe FilePath

-- | Whether to record a failure the first time this test is run
[failFirstTime] :: Golden str -> Bool

-- | An example of Golden tests which output is <a>String</a>
--   
--   <pre>
--   describe "html" $ do
--     context "given a valid generated html" $
--       it "generates html" $
--         defaultGolden "html" someHtml
--   </pre>
defaultGolden :: String -> String -> Golden String

-- | A helper function to create a golden test.
--   
--   <pre>
--   describe "function" $
--     golden "some name" $
--       return content
--   </pre>
golden :: String -> IO String -> Spec
instance GHC.Classes.Eq str => Test.Hspec.Core.Example.Example (arg -> GHC.Types.IO (Test.Hspec.Golden.Golden str))
instance GHC.Classes.Eq str => Test.Hspec.Core.Example.Example (arg -> Test.Hspec.Golden.Golden str)
instance GHC.Classes.Eq str => Test.Hspec.Core.Example.Example (Test.Hspec.Golden.Golden str)
instance GHC.Classes.Eq str => Test.Hspec.Core.Example.Example (GHC.Types.IO (Test.Hspec.Golden.Golden str))
