1+ {-# LANGUAGE CPP #-}
2+ {- HLINT ignore "Use fewer imports" -}
3+
14module LazyHClose (testSuite ) where
25
36import Control.Monad (void , forM_ )
@@ -6,22 +9,31 @@ import Foreign.C.String (withCString)
69import Foreign.ForeignPtr (finalizeForeignPtr )
710import System.IO (openFile , openTempFile , hClose , hPutStrLn , IOMode (.. ))
811import System.Posix.Internals (c_unlink )
9- import Test.Tasty (TestTree , testGroup , withResource )
12+ import Test.Tasty (TestTree , withResource )
1013import Test.Tasty.QuickCheck (testProperty , ioProperty )
1114
1215import qualified Data.ByteString as S
1316import qualified Data.ByteString.Char8 as S8
1417import qualified Data.ByteString.Lazy as L
1518import qualified Data.ByteString.Lazy.Char8 as L8
1619
20+ #if MIN_VERSION_tasty(1,5,4)
21+ import Test.Tasty (inOrderTestGroup )
22+ #else
23+ import Test.Tasty (testGroup )
24+
25+ inOrderTestGroup :: String -> [TestTree ] -> TestTree
26+ inOrderTestGroup = testGroup
27+ #endif
28+
1729n :: Int
1830n = 1000
1931
2032testSuite :: TestTree
2133testSuite = withResource
2234 (do (fn, h) <- openTempFile " ." " lazy-hclose-test.tmp" ; hPutStrLn h " x" ; hClose h; pure fn)
2335 removeFile $ \ fn' ->
24- testGroup " LazyHClose"
36+ inOrderTestGroup " LazyHClose"
2537 [ testProperty " Testing resource leaks for Strict.readFile" $ ioProperty $
2638 forM_ [1 .. n] $ const $ do
2739 fn <- fn'
0 commit comments