graphql-engine/server/lib/api-tests/ghci/fixtureRepl.ghci

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
687 B
Plaintext
Raw Normal View History

import Data.List qualified as List
:{
fixtureReplMacro :: String -> IO String
fixtureReplMacro module_ = do
return $ List.unlines
[ "import Data.Aeson.Encode.Pretty (encodePretty)",
"import Data.ByteString.Lazy.Char8 qualified as BS",
"import Harness.Test.Fixture",
"import Harness.Logging",
"import System.Environment",
":m + *SpecHook *" ++ module_,
"Right mode <- fmap lookupTestingMode getEnvironment",
"te <- setupTestEnvironment mode (Logger $ BS.putStrLn . encodePretty . fromLoggableMessage)",
"te",
"putStrLn \"Now do: \\\"cleanup <- fixtureRepl <fixture name> te\\\"\""
]
:}
:def fixtureRepl fixtureReplMacro