Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
task:
name: FreeBSD
freebsd_instance:
image_family: freebsd-14-2
image_family: freebsd-14-3
install_script:
- pkg install -y git gmake
- curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 sh
Expand All @@ -18,7 +18,8 @@ task:
platform: openbsd
install_script: pkg_add ghc cabal-install git
script:
- export CABAL_DIR=/tmp/.cabal
- mkdir -p /home/cabal
- ln -s /home/cabal $HOME/.cabal
- cabal update
- cabal test --test-show-details=direct

Expand Down
4 changes: 3 additions & 1 deletion Data/ByteString/Short/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ import GHC.Stack.Types
( HasCallStack )
import GHC.Word
import Prelude
( Eq(..), Ord(..), Ordering(..), Read(..), Show(..)
( Eq, (==), (/=)
, Ord, compare, (<), (<=), (>), (>=), min, max
, Ordering(..), Read(..), Show(..)
, ($), ($!), error, (++), (.), (||)
, String, userError
, Bool(..), (&&), otherwise
Expand Down
16 changes: 14 additions & 2 deletions tests/LazyHClose.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{-# LANGUAGE CPP #-}
{- HLINT ignore "Use fewer imports" -}

module LazyHClose (testSuite) where

import Control.Monad (void, forM_)
Expand All @@ -6,22 +9,31 @@ import Foreign.C.String (withCString)
import Foreign.ForeignPtr (finalizeForeignPtr)
import System.IO (openFile, openTempFile, hClose, hPutStrLn, IOMode(..))
import System.Posix.Internals (c_unlink)
import Test.Tasty (TestTree, testGroup, withResource)
import Test.Tasty (TestTree, withResource)
import Test.Tasty.QuickCheck (testProperty, ioProperty)

import qualified Data.ByteString as S
import qualified Data.ByteString.Char8 as S8
import qualified Data.ByteString.Lazy as L
import qualified Data.ByteString.Lazy.Char8 as L8

#if MIN_VERSION_tasty(1,5,4)
import Test.Tasty (inOrderTestGroup)
#else
import Test.Tasty (testGroup)

inOrderTestGroup :: String -> [TestTree] -> TestTree
inOrderTestGroup = testGroup
#endif

n :: Int
n = 1000

testSuite :: TestTree
testSuite = withResource
(do (fn, h) <- openTempFile "." "lazy-hclose-test.tmp"; hPutStrLn h "x"; hClose h; pure fn)
removeFile $ \fn' ->
testGroup "LazyHClose"
inOrderTestGroup "LazyHClose"
[ testProperty "Testing resource leaks for Strict.readFile" $ ioProperty $
forM_ [1..n] $ const $ do
fn <- fn'
Expand Down
Loading