Skip to content

Commit bd3436b

Browse files
committed
Restructure test
Now we always add a test containining the whole action, instead of adding the test only at the end if everything succeeded.
1 parent 95d167c commit bd3436b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/test/Stack/Untar/UntarSpec.hs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
{-# LANGUAGE FlexibleContexts #-}
2+
{-# LANGUAGE OverloadedStrings #-}
13
{-# OPTIONS_GHC -fno-warn-orphans #-}
2-
{-# LANGUAGE OverloadedStrings #-}
34

45
module Stack.Untar.UntarSpec where
56

@@ -24,11 +25,15 @@ spec = do
2425
, ("test2", [ ("test2" </> "bar", "named pipe")
2526
, ("test2" </> "devB", "block device")
2627
, ("test2" </> "devC", "character device")])]
27-
testTarFile (name, expected) = do
28+
testTarFile (name, expected) =
29+
it ("works on test " ++ name) $
30+
getEntries name `shouldReturn` sort expected
31+
32+
getEntries name = do
2833
let tarFP = currentFolder </> name ++ ".tar.gz"
2934
expectedTarFolder = name
3035
dest = currentFolder
3136

32-
entries <- runIO $ untar tarFP expectedTarFolder dest
33-
runIO $ removeDirectoryRecursive $ currentFolder </> expectedTarFolder
34-
it ("works on test " ++ name) $ sort entries `shouldBe` sort expected
37+
entries <- untar tarFP expectedTarFolder dest
38+
removeDirectoryRecursive $ currentFolder </> expectedTarFolder
39+
return $ sort entries

0 commit comments

Comments
 (0)