Skip to content

Commit ab9a25d

Browse files
committed
Use workspace function from hedgehog-extras for creating temp dir
1 parent 7fb2bf8 commit ab9a25d

2 files changed

Lines changed: 7 additions & 11 deletions

File tree

cardano-wasm/cardano-wasm.cabal

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,8 @@ test-suite cardano-wasm-golden
8585
filepath,
8686
hedgehog >=1.1,
8787
hedgehog-extras ^>=0.8,
88-
monad-control,
8988
tasty,
9089
tasty-hedgehog,
91-
temporary,
9290

9391
ghc-options:
9492
-threaded

cardano-wasm/test/cardano-wasm-golden/Test/Golden/Cardano/Wasm/TypeScript.hs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,21 @@ module Test.Golden.Cardano.Wasm.TypeScript where
22

33
import Control.Monad (forM_)
44
import Control.Monad.IO.Class qualified as H
5-
import Control.Monad.Trans.Control (control)
65
import System.FilePath ((</>))
7-
import System.IO.Temp (withSystemTempDirectory)
86

97
import Hedgehog as H
8+
import Hedgehog.Extras (workspace)
109
import Hedgehog.Extras qualified as H
1110

1211
hprop_cardano_wasm_typescript_declarations_match_generated :: Property
1312
hprop_cardano_wasm_typescript_declarations_match_generated =
1413
H.propertyOnce $ do
15-
control $ \runInHedgehog ->
16-
H.liftIO $ withSystemTempDirectory "cardano-wasm-ts-decls" $ \dir -> do
17-
runInHedgehog $ do
18-
_ <- H.execFlex "cardano-wasm" "CARDANO_WASM" ["--output-dir", dir]
19-
forFilesInDir dir $ \file -> do
20-
H.annotate (dir </> file)
21-
H.diffFileVsGoldenFile (dir </> file) ("lib-wrapper" </> file)
14+
workspace "cardano-wasm-ts-decls" $ \workDir -> do
15+
dir <- H.createDirectoryIfMissing (workDir </> "lib-wrapper")
16+
_ <- H.execFlex "cardano-wasm" "CARDANO_WASM" ["--output-dir", dir]
17+
forFilesInDir dir $ \file -> do
18+
H.annotate (dir </> file)
19+
H.diffFileVsGoldenFile (dir </> file) ("lib-wrapper" </> file)
2220

2321
forFilesInDir :: (H.MonadTest m, H.MonadIO m) => FilePath -> (FilePath -> m ()) -> m ()
2422
forFilesInDir dir action = do

0 commit comments

Comments
 (0)