Skip to content

Use tasty instead of test-framework #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 8, 2024
Merged
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
12 changes: 6 additions & 6 deletions hashable.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ test-suite hashable-tests
, ghc-prim
, hashable
, HUnit
, QuickCheck >=2.4.0.1
, random >=1.0 && <1.3
, test-framework >=0.3.3
, test-framework-hunit
, test-framework-quickcheck2 >=0.2.9
, text >=0.11.0.5
, QuickCheck >=2.4.0.1
, random >=1.0 && <1.3
, tasty ^>=1.5
, tasty-hunit ^>=0.10.1
, tasty-quickcheck ^>=0.10.3
, text >=0.11.0.5

if impl(ghc >=9.2)
build-depends: os-string
Expand Down
10 changes: 5 additions & 5 deletions tests/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ module Main (main) where

import Properties (properties)
import Regress (regressions)
import Test.Framework (defaultMain, testGroup)
import Test.Tasty (defaultMain, testGroup)

main :: IO ()
main = defaultMain [
testGroup "properties" properties
, testGroup "regressions" regressions
]
main = defaultMain $ testGroup "hashable"
[ testGroup "properties" properties
, testGroup "regressions" regressions
]
6 changes: 3 additions & 3 deletions tests/Properties.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
import GHC.ST (ST(..), runST)
import GHC.Word (Word8(..))
import Test.QuickCheck hiding ((.&.))
import Test.Framework (Test, testGroup)
import Test.Framework.Providers.QuickCheck2 (testProperty)
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.QuickCheck (testProperty)
import GHC.Generics

import qualified Data.ByteString.Short as BS

#if MIN_VERSION_filepath(1,4,100) && !(MIN_VERSION_filepath(1,5,0))
import qualified "filepath" System.OsString.Internal.Types as FP

Check warning on line 34 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.6.5 on macos-latest

Module ‘System.OsString.Internal.Types’ is deprecated:

Check warning on line 34 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.6.5 on windows-latest

Module ‘System.OsString.Internal.Types’ is deprecated:
#endif

#ifdef MIN_VERSION_os_string
Expand Down Expand Up @@ -178,10 +178,10 @@
-- Hashes of all product types of the same shapes should be the same.

pProduct2 :: Int -> String -> Bool
pProduct2 x y = hash (x, y) == hash (Product2 x y)

Check warning on line 181 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.2 on macos-latest

Defined but not used: ‘pProduct2’

Check warning on line 181 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.4.8 on macos-latest

Defined but not used: ‘pProduct2’

Check warning on line 181 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.6.5 on macos-latest

Defined but not used: ‘pProduct2’

Check warning on line 181 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.8.2 on macos-latest

Defined but not used: ‘pProduct2’

Check warning on line 181 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.2 on windows-latest

Defined but not used: ‘pProduct2’

Check warning on line 181 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.4.8 on windows-latest

Defined but not used: ‘pProduct2’

Check warning on line 181 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.6.5 on windows-latest

Defined but not used: ‘pProduct2’

Check warning on line 181 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.8.2 on windows-latest

Defined but not used: ‘pProduct2’

pProduct3 :: Double -> Maybe Bool -> (Int, String) -> Bool
pProduct3 x y z = hash (x, y, z) == hash (Product3 x y z)

Check warning on line 184 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.2 on macos-latest

Defined but not used: ‘pProduct3’

Check warning on line 184 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.4.8 on macos-latest

Defined but not used: ‘pProduct3’

Check warning on line 184 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.6.5 on macos-latest

Defined but not used: ‘pProduct3’

Check warning on line 184 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.8.2 on macos-latest

Defined but not used: ‘pProduct3’

Check warning on line 184 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.2 on windows-latest

Defined but not used: ‘pProduct3’

Check warning on line 184 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.4.8 on windows-latest

Defined but not used: ‘pProduct3’

Check warning on line 184 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.6.5 on windows-latest

Defined but not used: ‘pProduct3’

Check warning on line 184 in tests/Properties.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.8.2 on windows-latest

Defined but not used: ‘pProduct3’

data Sum2 a b = S2a a | S2b b
deriving (Eq, Ord, Show, Generic)
Expand Down Expand Up @@ -225,7 +225,7 @@
pLiftedHashed :: Int -> Hashed (Either Int String) -> Bool
pLiftedHashed s h = hashWithSalt s h == hashWithSalt1 s h

properties :: [Test]
properties :: [TestTree]
properties =
[ testProperty "bernstein" pHash
, testGroup "text"
Expand Down
13 changes: 6 additions & 7 deletions tests/Regress.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@

module Regress (regressions) where

import qualified Test.Framework as F
import Test.Tasty (TestTree, testGroup)
import Control.Monad (when)
import Test.Framework.Providers.HUnit (testCase)
import Test.HUnit (Assertion, assertFailure, (@?=))
import Test.Framework.Providers.QuickCheck2 (testProperty)
import Test.Tasty.HUnit (testCase, Assertion, assertFailure, (@?=))
import Test.Tasty.QuickCheck (testProperty)
import GHC.Generics (Generic)
import Data.List (nub)
import Data.Fixed (Pico)

Check warning on line 13 in tests/Regress.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.2 on windows-latest

The import of ‘Data.Fixed’ is redundant

Check warning on line 13 in tests/Regress.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.4.8 on windows-latest

The import of ‘Data.Fixed’ is redundant

Check warning on line 13 in tests/Regress.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.6.5 on windows-latest

The import of ‘Data.Fixed’ is redundant

Check warning on line 13 in tests/Regress.hs

View workflow job for this annotation

GitHub Actions / Simple: GHC 9.8.2 on windows-latest

The import of ‘Data.Fixed’ is redundant
import Data.Text (Text)
import Data.ByteString (ByteString)

Expand All @@ -33,15 +32,15 @@
| x == y = assertFailure msg
| otherwise = return ()

regressions :: [F.Test]
regressions :: [TestTree]
regressions = [] ++
#ifdef HAVE_MMAP
Mmap.regressions ++
[ testCase "Fixed" $ do
(hash (1 :: Pico) == hash (2 :: Pico)) @?= False
] ++
#endif
[ F.testGroup "Generic: sum of nullary constructors"
[ testGroup "Generic: sum of nullary constructors"
[ testCase "0" $ nullaryCase 0 S0
, testCase "1" $ nullaryCase 1 S1
, testCase "2" $ nullaryCase 2 S2
Expand Down Expand Up @@ -72,7 +71,7 @@
#endif
hash ("hello world" :: Text) @?= expected
#endif
, F.testGroup "concatenation"
, testGroup "concatenation"
[ testCase "String" $ do
let lhs, rhs :: (String, String)
lhs = ("foo", "bar")
Expand Down
6 changes: 3 additions & 3 deletions tests/Regress/Mmap.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import Foreign.C.Types (CInt(..), CSize(..))
import Foreign.Ptr (Ptr, intPtrToPtr, nullPtr, plusPtr)
import GHC.ForeignPtr (newForeignPtr_)
import System.Posix.Types (COff(..))
import Test.Framework (Test)
import Test.Framework.Providers.HUnit (testCase)
import Test.Tasty (TestTree)
import Test.Tasty.HUnit (testCase)
import qualified Data.ByteString as B

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

regressions :: [Test]
regressions :: [TestTree]
regressions = [
testCase "hashNearPageBoundary" hashNearPageBoundary
]
Expand Down
Loading