Skip to content

Commit 8b7a982

Browse files
committed
Fix building testsuite with various ghc versions
and warnings
1 parent 885b847 commit 8b7a982

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

test/Test.hs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
{-# LANGUAGE StandaloneDeriving #-}
2-
{-# OPTIONS_GHC -fno-warn-orphans #-}
1+
{-# LANGUAGE CPP #-}
32

43
module Main where
54

@@ -24,7 +23,10 @@ import qualified Data.ByteString.Char8 as BS.Char8
2423
import qualified Data.ByteString.Lazy as BL
2524
import qualified Data.ByteString as BS
2625
import System.IO
26+
#if !(MIN_VERSION_base(4,6,0))
2727
import Prelude hiding (catch)
28+
#endif
29+
2830

2931

3032
main :: IO ()
@@ -161,7 +163,7 @@ test_right_dictionary = do
161163
dict <- readSampleData "custom-dict.zlib-dict"
162164
let decomp = decompressIO zlibFormat defaultDecompressParams {
163165
decompressDictionary =
164-
Just (BL.toStrict dict)
166+
Just (toStrict dict)
165167
}
166168
assertDecompressOk hnd decomp
167169

@@ -203,6 +205,12 @@ test_exception =
203205
msg <- assertDataFormatError err
204206
msg @?= "incorrect data check"
205207

208+
toStrict :: BL.ByteString -> BS.ByteString
209+
#if MIN_VERSION_bytestring(0,10,0)
210+
toStrict = BL.toStrict
211+
#else
212+
toStrict = BS.concat . BL.toChunks
213+
#endif
206214

207215
--------------
208216
-- HUnit Utils

zlib.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ test-suite tests
7676
build-depends: base, bytestring, zlib,
7777
QuickCheck == 2.*,
7878
HUnit == 1.2.*,
79-
tasty == 0.8.*,
79+
tasty >= 0.8 && < 0.11,
8080
tasty-quickcheck == 0.8.*,
8181
tasty-hunit == 0.8.*
8282
ghc-options: -Wall

0 commit comments

Comments
 (0)