2023-02-01 15:33:31 +03:00
|
|
|
import Data.List qualified as List
|
2022-11-25 15:33:09 +03:00
|
|
|
|
|
|
|
:{
|
|
|
|
fixtureReplMacro :: String -> IO String
|
|
|
|
fixtureReplMacro module_ = do
|
2023-02-01 15:33:31 +03:00
|
|
|
return $ List.unlines
|
2022-12-22 14:25:28 +03:00
|
|
|
[ "import Data.Aeson.Encode.Pretty (encodePretty)",
|
|
|
|
"import Data.ByteString.Lazy.Char8 qualified as BS",
|
|
|
|
"import Harness.Test.Fixture",
|
2022-11-25 15:33:09 +03:00
|
|
|
"import Harness.Logging",
|
2022-12-22 14:25:28 +03:00
|
|
|
"import System.Environment",
|
2022-11-25 15:33:09 +03:00
|
|
|
":m + *SpecHook *" ++ module_,
|
2022-12-22 14:25:28 +03:00
|
|
|
"Right mode <- fmap lookupTestingMode getEnvironment",
|
|
|
|
"te <- setupTestEnvironment mode (Logger $ BS.putStrLn . encodePretty . fromLoggableMessage)",
|
2022-11-25 15:33:09 +03:00
|
|
|
"te",
|
|
|
|
"putStrLn \"Now do: \\\"cleanup <- fixtureRepl <fixture name> te\\\"\""
|
|
|
|
]
|
|
|
|
:}
|
|
|
|
|
|
|
|
:def fixtureRepl fixtureReplMacro
|