Skip to content

Commit cfec944

Browse files
committed
Use tasty instead of test-framework
1 parent 89f6150 commit cfec944

File tree

5 files changed

+23
-24
lines changed

5 files changed

+23
-24
lines changed

hashable.cabal

+6-6
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,12 @@ test-suite hashable-tests
192192
, ghc-prim
193193
, hashable
194194
, HUnit
195-
, QuickCheck >=2.4.0.1
196-
, random >=1.0 && <1.3
197-
, test-framework >=0.3.3
198-
, test-framework-hunit
199-
, test-framework-quickcheck2 >=0.2.9
200-
, text >=0.11.0.5
195+
, QuickCheck >=2.4.0.1
196+
, random >=1.0 && <1.3
197+
, tasty ^>=1.5
198+
, tasty-hunit ^>=0.10.1
199+
, tasty-quickcheck ^>=0.10.3
200+
, text >=0.11.0.5
201201

202202
if impl(ghc >=9.2)
203203
build-depends: os-string

tests/Main.hs

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ module Main (main) where
55

66
import Properties (properties)
77
import Regress (regressions)
8-
import Test.Framework (defaultMain, testGroup)
8+
import Test.Tasty (defaultMain, testGroup)
99

1010
main :: IO ()
11-
main = defaultMain [
12-
testGroup "properties" properties
13-
, testGroup "regressions" regressions
14-
]
11+
main = defaultMain $ testGroup "hashable"
12+
[ testGroup "properties" properties
13+
, testGroup "regressions" regressions
14+
]

tests/Properties.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import GHC.Exts (unsafeCoerce#)
2424
import GHC.ST (ST(..), runST)
2525
import GHC.Word (Word8(..))
2626
import Test.QuickCheck hiding ((.&.))
27-
import Test.Framework (Test, testGroup)
28-
import Test.Framework.Providers.QuickCheck2 (testProperty)
27+
import Test.Tasty (TestTree, testGroup)
28+
import Test.Tasty.QuickCheck (testProperty)
2929
import GHC.Generics
3030

3131
import qualified Data.ByteString.Short as BS
@@ -225,7 +225,7 @@ instance (Arbitrary a, Hashable a) => Arbitrary (Hashed a) where
225225
pLiftedHashed :: Int -> Hashed (Either Int String) -> Bool
226226
pLiftedHashed s h = hashWithSalt s h == hashWithSalt1 s h
227227

228-
properties :: [Test]
228+
properties :: [TestTree]
229229
properties =
230230
[ testProperty "bernstein" pHash
231231
, testGroup "text"

tests/Regress.hs

+6-7
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44

55
module Regress (regressions) where
66

7-
import qualified Test.Framework as F
7+
import Test.Tasty (TestTree, testGroup)
88
import Control.Monad (when)
9-
import Test.Framework.Providers.HUnit (testCase)
10-
import Test.HUnit (Assertion, assertFailure, (@?=))
11-
import Test.Framework.Providers.QuickCheck2 (testProperty)
9+
import Test.Tasty.HUnit (testCase, Assertion, assertFailure, (@?=))
10+
import Test.Tasty.QuickCheck (testProperty)
1211
import GHC.Generics (Generic)
1312
import Data.List (nub)
1413
import Data.Fixed (Pico)
@@ -33,15 +32,15 @@ assertInequal msg x y
3332
| x == y = assertFailure msg
3433
| otherwise = return ()
3534

36-
regressions :: [F.Test]
35+
regressions :: [TestTree]
3736
regressions = [] ++
3837
#ifdef HAVE_MMAP
3938
Mmap.regressions ++
4039
[ testCase "Fixed" $ do
4140
(hash (1 :: Pico) == hash (2 :: Pico)) @?= False
4241
] ++
4342
#endif
44-
[ F.testGroup "Generic: sum of nullary constructors"
43+
[ testGroup "Generic: sum of nullary constructors"
4544
[ testCase "0" $ nullaryCase 0 S0
4645
, testCase "1" $ nullaryCase 1 S1
4746
, testCase "2" $ nullaryCase 2 S2
@@ -72,7 +71,7 @@ regressions = [] ++
7271
#endif
7372
hash ("hello world" :: Text) @?= expected
7473
#endif
75-
, F.testGroup "concatenation"
74+
, testGroup "concatenation"
7675
[ testCase "String" $ do
7776
let lhs, rhs :: (String, String)
7877
lhs = ("foo", "bar")

tests/Regress/Mmap.hsc

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import Foreign.C.Types (CInt(..), CSize(..))
1414
import Foreign.Ptr (Ptr, intPtrToPtr, nullPtr, plusPtr)
1515
import GHC.ForeignPtr (newForeignPtr_)
1616
import System.Posix.Types (COff(..))
17-
import Test.Framework (Test)
18-
import Test.Framework.Providers.HUnit (testCase)
17+
import Test.Tasty (TestTree)
18+
import Test.Tasty.HUnit (testCase)
1919
import qualified Data.ByteString as B
2020

2121
withMapping :: (Ptr a -> Int -> IO ()) -> IO ()
@@ -43,7 +43,7 @@ hashNearPageBoundary =
4343
forM_ (B.tails bs0) $ \bs -> do
4444
evaluate (hash bs)
4545

46-
regressions :: [Test]
46+
regressions :: [TestTree]
4747
regressions = [
4848
testCase "hashNearPageBoundary" hashNearPageBoundary
4949
]

0 commit comments

Comments
 (0)