Skip to content
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

Migrate tests from test-framework to tasty #316

Merged
merged 8 commits into from
Feb 17, 2022
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
10 changes: 5 additions & 5 deletions tests/HashMapProperties.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{-# OPTIONS_GHC -fno-warn-orphans #-} -- because of Arbitrary (HashMap k v)

-- | Tests for the 'Data.HashMap.Lazy' module. We test functions by
-- comparing them to a simpler model, an association list.
-- comparing them to @Map@ from @containers@.

module Main (main) where

Expand All @@ -25,8 +25,8 @@ import qualified Data.HashMap.Lazy as HM
import qualified Data.Map.Lazy as M
#endif
import Test.QuickCheck (Arbitrary(..), Property, (==>), (===), forAll, elements)
import Test.Framework (Test, defaultMain, testGroup)
import Test.Framework.Providers.QuickCheck2 (testProperty)
import Test.Tasty (TestTree, defaultMain, testGroup)
import Test.Tasty.QuickCheck (testProperty)
import Data.Functor.Identity (Identity (..))
import Control.Applicative (Const (..))
import Test.QuickCheck.Function (Fun, apply)
Expand Down Expand Up @@ -440,8 +440,8 @@ pKeys = (L.sort . M.keys) `eq` (L.sort . HM.keys)
------------------------------------------------------------------------
-- * Test list

tests :: [Test]
tests =
tests :: TestTree
tests = testGroup "HashMap properties"
[
-- Instances
testGroup "instances"
Expand Down
10 changes: 5 additions & 5 deletions tests/HashSetProperties.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# LANGUAGE CPP, GeneralizedNewtypeDeriving #-}

-- | Tests for the 'Data.HashSet' module. We test functions by
-- comparing them to a simpler model, a list.
-- comparing them to @Set@ from @containers@.

module Main (main) where

Expand All @@ -12,8 +12,8 @@ import qualified Data.HashSet as S
import qualified Data.Set as Set
import Data.Ord (comparing)
import Test.QuickCheck (Arbitrary, Property, (==>), (===))
import Test.Framework (Test, defaultMain, testGroup)
import Test.Framework.Providers.QuickCheck2 (testProperty)
import Test.Tasty (TestTree, defaultMain, testGroup)
import Test.Tasty.QuickCheck (testProperty)

-- Key type that generates more hash collisions.
newtype Key = K { unK :: Int }
Expand Down Expand Up @@ -159,8 +159,8 @@ pToList = Set.toAscList `eq` toAscList
------------------------------------------------------------------------
-- * Test list

tests :: [Test]
tests =
tests :: TestTree
tests = testGroup "HashSet properties"
[
-- Instances
testGroup "instances"
Expand Down
8 changes: 4 additions & 4 deletions tests/List.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import Data.HashMap.Internal.List
import Data.List (nub, sort, sortBy)
import Data.Ord (comparing)

import Test.Framework (Test, defaultMain, testGroup)
import Test.Framework.Providers.QuickCheck2 (testProperty)
import Test.Tasty (TestTree, defaultMain, testGroup)
import Test.Tasty.QuickCheck (testProperty)
import Test.QuickCheck ((==>), (===), property, Property)

tests :: Test
tests :: TestTree
tests = testGroup "Data.HashMap.Internal.List"
[ testProperty "isPermutationBy" pIsPermutation
, testProperty "isPermutationBy of different length" pIsPermutationDiffLength
Expand Down Expand Up @@ -65,4 +65,4 @@ pUnorderedCompare xs ys =
unorderedCompare compare xs ys === modelUnorderedCompare xs ys

main :: IO ()
main = defaultMain [tests]
main = defaultMain tests
10 changes: 5 additions & 5 deletions tests/Regressions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import System.Mem (performGC)
import System.Mem.Weak (mkWeakPtr, deRefWeak)
import System.Random (randomIO)
import Test.HUnit (Assertion, assert)
import Test.Framework (Test, defaultMain)
import Test.Framework.Providers.HUnit (testCase)
import Test.Framework.Providers.QuickCheck2 (testProperty)
import Test.Tasty (TestTree, defaultMain, testGroup)
import Test.Tasty.HUnit (testCase)
import Test.Tasty.QuickCheck (testProperty)
import Test.QuickCheck

issue32 :: Assertion
Expand Down Expand Up @@ -126,8 +126,8 @@ issue254Strict = do
------------------------------------------------------------------------
-- * Test list

tests :: [Test]
tests =
tests :: TestTree
tests = testGroup "Regression tests"
[
testCase "issue32" issue32
, testCase "issue39a" issue39
Expand Down
8 changes: 4 additions & 4 deletions tests/Strictness.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module Main (main) where

import Data.Hashable (Hashable(hashWithSalt))
import Test.ChasingBottoms.IsBottom
import Test.Framework (Test, defaultMain, testGroup)
import Test.Framework.Providers.QuickCheck2 (testProperty)
import Test.Tasty (TestTree, defaultMain, testGroup)
import Test.Tasty.QuickCheck (testProperty)
import Test.QuickCheck (Arbitrary(arbitrary), Property, (===), (.&&.))
import Test.QuickCheck.Function
import Test.QuickCheck.Poly (A)
Expand Down Expand Up @@ -149,8 +149,8 @@ pFromListWithValueResultStrict lst comb_lazy calc_good_raw
------------------------------------------------------------------------
-- * Test list

tests :: [Test]
tests =
tests :: TestTree
tests = testGroup "Strictness tests"
[
-- Basic interface
testGroup "HashMap.Strict"
Expand Down
26 changes: 13 additions & 13 deletions unordered-containers.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ test-suite hashmap-lazy-properties
containers >= 0.5.8,
hashable >= 1.0.1.1,
QuickCheck >= 2.4.0.1,
test-framework >= 0.3.3,
test-framework-quickcheck2 >= 0.2.9,
tasty >= 1.4.0.3,
tasty-quickcheck >= 0.10.1.2,
unordered-containers

default-language: Haskell2010
Expand All @@ -106,8 +106,8 @@ test-suite hashmap-strict-properties
containers >= 0.5.8,
hashable >= 1.0.1.1,
QuickCheck >= 2.4.0.1,
test-framework >= 0.3.3,
test-framework-quickcheck2 >= 0.2.9,
tasty >= 1.4.0.3,
tasty-quickcheck >= 0.10.1.2,
unordered-containers

default-language: Haskell2010
Expand All @@ -124,8 +124,8 @@ test-suite hashset-properties
containers >= 0.4.2.0,
hashable >= 1.0.1.1,
QuickCheck >= 2.4.0.1,
test-framework >= 0.3.3,
test-framework-quickcheck2 >= 0.2.9,
tasty >= 1.4.0.3,
tasty-quickcheck >= 0.10.1.2,
unordered-containers

default-language: Haskell2010
Expand All @@ -143,8 +143,8 @@ test-suite list-tests
base,
containers >= 0.4,
QuickCheck >= 2.4.0.1,
test-framework >= 0.3.3,
test-framework-quickcheck2 >= 0.2.9
tasty >= 1.4.0.3,
tasty-quickcheck >= 0.10.1.2

default-language: Haskell2010
ghc-options: -Wall
Expand All @@ -161,9 +161,9 @@ test-suite regressions
HUnit,
QuickCheck >= 2.4.0.1,
random,
test-framework >= 0.3.3,
test-framework-hunit,
test-framework-quickcheck2,
tasty >= 1.4.0.3,
tasty-hunit >= 0.10.0.3,
tasty-quickcheck >= 0.10.1.2,
unordered-containers

default-language: Haskell2010
Expand All @@ -181,8 +181,8 @@ test-suite strictness-properties
containers >= 0.4.2,
hashable >= 1.0.1.1,
QuickCheck >= 2.4.0.1,
test-framework >= 0.3.3,
test-framework-quickcheck2 >= 0.2.9,
tasty >= 1.4.0.3,
tasty-quickcheck >= 0.10.1.2,
unordered-containers

default-language: Haskell2010
Expand Down