Skip to content

Commit a4aaeee

Browse files
committed
Migrate from checkers to quickcheck-classes-base
When built against GHC 9.6, checkers cause a cyclic dependency: filepath:tests -> checkers-0.6 -> semigroupoids-6 -> hashable-1.4.2.0 -> filepath quickcheck-classes-base are a replacement of checkers with a smaller dependency footprint.
1 parent 4380da1 commit a4aaeee

File tree

3 files changed

+13
-29
lines changed

3 files changed

+13
-29
lines changed

filepath.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ test-suite abstract-filepath
182182
build-depends:
183183
, base
184184
, bytestring >=0.11.3.0
185-
, checkers ^>=0.5.6
186185
, deepseq
187186
, filepath
188187
, QuickCheck >=2.7 && <2.15
188+
, quickcheck-classes-base ^>=0.6.2
189189

190190
benchmark bench-filepath
191191
default-language: Haskell2010

tests/abstract-filepath/Arbitrary.hs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,16 @@ import Data.ByteString ( ByteString )
1212
import qualified Data.ByteString as ByteString
1313
import Test.QuickCheck
1414

15-
import Test.QuickCheck.Checkers
16-
17-
1815

1916
instance Arbitrary OsString where
2017
arbitrary = fmap fromJust $ encodeUtf <$> listOf filepathChar
2118

22-
instance EqProp OsString where
23-
(=-=) = eq
24-
2519
instance Arbitrary PosixString where
2620
arbitrary = fmap fromJust $ Posix.encodeUtf <$> listOf filepathChar
2721

28-
instance EqProp PosixString where
29-
(=-=) = eq
30-
3122
instance Arbitrary WindowsString where
3223
arbitrary = fmap fromJust $ Windows.encodeUtf <$> listOf filepathChar
3324

34-
instance EqProp WindowsString where
35-
(=-=) = eq
36-
3725

3826
newtype NonNullString = NonNullString { nonNullString :: String }
3927
deriving Show

tests/abstract-filepath/OsPathSpec.hs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ import Control.Exception
2121
import Data.ByteString ( ByteString )
2222
import qualified Data.ByteString as BS
2323
import Test.QuickCheck
24-
import Test.QuickCheck.Checkers
25-
import qualified Test.QuickCheck.Classes as QC
24+
import qualified Test.QuickCheck.Classes.Base as QC
2625
import GHC.IO.Encoding.UTF8 ( mkUTF8 )
2726
import GHC.IO.Encoding.UTF16 ( mkUTF16le )
2827
import GHC.IO.Encoding ( setFileSystemEncoding )
@@ -33,6 +32,7 @@ import qualified Data.ByteString.Char8 as C
3332
import qualified System.OsPath.Data.ByteString.Short.Word16 as BS16
3433
import qualified System.OsPath.Data.ByteString.Short as SBS
3534
import Data.Char ( ord )
35+
import Data.Proxy ( Proxy(..) )
3636

3737
import Arbitrary
3838

@@ -233,24 +233,20 @@ tests =
233233
)
234234

235235

236-
] ++ testBatch (QC.ord (\(a :: OsPath) -> pure a))
237-
++ testBatch (QC.monoid (undefined :: OsPath))
236+
] ++ QC.lawsProperties (QC.ordLaws (Proxy @OsPath))
237+
++ QC.lawsProperties (QC.monoidLaws (Proxy @OsPath))
238238

239-
++ testBatch (QC.ord (\(a :: OsString) -> pure a))
240-
++ testBatch (QC.monoid (undefined :: OsString))
239+
++ QC.lawsProperties (QC.ordLaws (Proxy @OsString))
240+
++ QC.lawsProperties (QC.monoidLaws (Proxy @OsString))
241241

242-
++ testBatch (QC.ord (\(a :: WindowsString) -> pure a))
243-
++ testBatch (QC.monoid (undefined :: WindowsString))
242+
++ QC.lawsProperties (QC.ordLaws (Proxy @WindowsString))
243+
++ QC.lawsProperties (QC.monoidLaws (Proxy @WindowsString))
244244

245-
++ testBatch (QC.ord (\(a :: PosixString) -> pure a))
246-
++ testBatch (QC.monoid (undefined :: PosixString))
245+
++ QC.lawsProperties (QC.ordLaws (Proxy @PosixString))
246+
++ QC.lawsProperties (QC.monoidLaws (Proxy @PosixString))
247247

248-
++ testBatch (QC.ord (\(a :: PlatformString) -> pure a))
249-
++ testBatch (QC.monoid (undefined :: PlatformString))
250-
251-
-- | Allows to insert a 'TestBatch' into a Spec.
252-
testBatch :: TestBatch -> [(String, Property)]
253-
testBatch (_, tests') = tests'
248+
++ QC.lawsProperties (QC.ordLaws (Proxy @PlatformString))
249+
++ QC.lawsProperties (QC.monoidLaws (Proxy @PlatformString))
254250

255251

256252
padEven :: ByteString -> ByteString

0 commit comments

Comments
 (0)