Skip to content

Commit 1667974

Browse files
committed
Switch from test-framework to tasty
1 parent 6d8ae4d commit 1667974

File tree

8 files changed

+25
-28
lines changed

8 files changed

+25
-28
lines changed

tests/Tests.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ module Main
44
( main
55
) where
66

7-
import Test.Framework (defaultMain)
7+
import Test.Tasty (defaultMain, testGroup)
88

99
import qualified Tests.Properties as Properties
1010
import qualified Tests.Regressions as Regressions
1111

1212
main :: IO ()
13-
main = defaultMain [Properties.tests, Regressions.tests]
13+
main = defaultMain $ testGroup "All" [Properties.tests, Regressions.tests]

tests/Tests/Properties.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import Data.Word (Word, Word8, Word16, Word32, Word64)
2727
import Data.Maybe (mapMaybe)
2828
import Numeric (showEFloat, showFFloat, showGFloat, showHex)
2929
import Prelude hiding (replicate)
30-
import Test.Framework (Test, testGroup)
31-
import Test.Framework.Providers.QuickCheck2 (testProperty)
30+
import Test.Tasty (TestTree, testGroup)
31+
import Test.Tasty.QuickCheck (testProperty)
3232
import Test.QuickCheck hiding ((.&.))
3333
import Test.QuickCheck.Monadic
3434
import Test.QuickCheck.Property (Property(..))
@@ -968,7 +968,7 @@ shorten n t@(S.Stream arr off len)
968968
| n > 0 = S.Stream arr off (smaller (exactSize n) len)
969969
| otherwise = t
970970

971-
tests :: Test
971+
tests :: TestTree
972972
tests =
973973
testGroup "Properties" [
974974
testGroup "creation/elimination" [

tests/Tests/Properties/Mul.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import Control.Exception as E (SomeException, catch, evaluate)
77
import Data.Int (Int32, Int64)
88
import Data.Text.Internal (mul, mul32, mul64)
99
import System.IO.Unsafe (unsafePerformIO)
10-
import Test.Framework (Test)
11-
import Test.Framework.Providers.QuickCheck2 (testProperty)
10+
import Test.Tasty (TestTree)
11+
import Test.Tasty.QuickCheck (testProperty)
1212
import Test.QuickCheck hiding ((.&.))
1313

1414
mulRef :: (Integral a, Bounded a) => a -> a -> Maybe a
@@ -32,7 +32,7 @@ t_mul64 a b = mulRef a b === eval mul64 a b
3232
t_mul :: Int -> Int -> Property
3333
t_mul a b = mulRef a b === eval mul a b
3434

35-
tests :: [Test]
35+
tests :: [TestTree]
3636
tests = [
3737
testProperty "t_mul" t_mul
3838
, testProperty "t_mul32" t_mul32

tests/Tests/Regressions.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module Tests.Regressions
99
import Control.Exception (SomeException, handle)
1010
import Data.Char (isLetter)
1111
import System.IO
12-
import Test.HUnit (assertBool, assertEqual, assertFailure)
12+
import Test.Tasty.HUnit (assertBool, assertEqual, assertFailure)
1313
import qualified Data.ByteString as B
1414
import Data.ByteString.Char8 ()
1515
import qualified Data.ByteString.Lazy as LB
@@ -21,8 +21,8 @@ import qualified Data.Text.IO as T
2121
import qualified Data.Text.Lazy as LT
2222
import qualified Data.Text.Lazy.Encoding as LE
2323
import qualified Data.Text.Unsafe as T
24-
import qualified Test.Framework as F
25-
import qualified Test.Framework.Providers.HUnit as F
24+
import qualified Test.Tasty as F
25+
import qualified Test.Tasty.HUnit as F
2626

2727
import Tests.Utils (withTempFile)
2828

@@ -115,7 +115,7 @@ t301 = do
115115
original@(T.Text originalArr originalOff originalLen) = T.pack "1234567890"
116116
T.Text newArr _off _len = T.take 1 $ T.drop 1 original
117117

118-
tests :: F.Test
118+
tests :: F.TestTree
119119
tests = F.testGroup "Regressions"
120120
[ F.testCase "hGetContents_crash" hGetContents_crash
121121
, F.testCase "lazy_encode_crash" lazy_encode_crash

tests/text-tests.cabal

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ test-suite tests
159159
Data.Text.Show
160160

161161
build-depends:
162-
HUnit >= 1.2,
163162
QuickCheck >= 2.14.1 && < 2.15,
164163
array,
165164
base <5,
@@ -170,9 +169,9 @@ test-suite tests
170169
quickcheck-unicode >= 1.0.1.0,
171170
random,
172171
template-haskell,
173-
test-framework >= 0.4,
174-
test-framework-hunit >= 0.2,
175-
test-framework-quickcheck2 >= 0.2
172+
tasty,
173+
tasty-hunit,
174+
tasty-quickcheck
176175

177176
if flag(bytestring-builder)
178177
build-depends: bytestring >= 0.9 && < 0.10.4,

th-tests/tests/Lift.hs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ module Lift
88
import qualified Data.Text as S
99
import qualified Data.Text.Lazy as L
1010
import Language.Haskell.TH.Syntax (lift)
11-
import Test.HUnit (assertBool, assertEqual, assertFailure)
12-
import qualified Test.Framework as F
13-
import qualified Test.Framework.Providers.HUnit as F
11+
import Test.Tasty.HUnit (testCase, assertEqual)
12+
import Test.Tasty (TestTree, testGroup)
1413

15-
tests :: F.Test
16-
tests = F.testGroup "TH lifting Text"
17-
[ F.testCase "strict" $ assertEqual "strict"
14+
tests :: TestTree
15+
tests = testGroup "TH lifting Text"
16+
[ testCase "strict" $ assertEqual "strict"
1817
$(lift ("foo" :: S.Text))
1918
("foo" :: S.Text)
20-
, F.testCase "lazy" $ assertEqual "lazy"
19+
, testCase "lazy" $ assertEqual "lazy"
2120
$(lift ("foo" :: L.Text))
2221
("foo" :: L.Text)
2322
]

th-tests/tests/th-tests.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ module Main
44
( main
55
) where
66

7-
import Test.Framework (defaultMain)
7+
import Test.Tasty (defaultMain)
88

99
import qualified Lift
1010

1111
main :: IO ()
12-
main = defaultMain [Lift.tests]
12+
main = defaultMain Lift.tests

th-tests/th-tests.cabal

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ test-suite th-tests
2424
other-modules:
2525
Lift
2626
build-depends:
27-
HUnit >= 1.2,
2827
base <5,
2928
template-haskell,
3029
text,
31-
test-framework >= 0.4,
32-
test-framework-hunit >= 0.2
30+
tasty,
31+
tasty-hunit

0 commit comments

Comments
 (0)