Skip to content

Commit 4fbf0b9

Browse files
committed
testsuite: Port to tasty and tasty-hunit
1 parent 2d6e7a3 commit 4fbf0b9

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

Diff for: hsc2hs.cabal

+2-3
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ test-suite spec
9999
ghc-options: -Wall -threaded
100100
type: exitcode-stdio-1.0
101101
build-depends: base >= 4.3.0 && < 4.22,
102-
test-framework >= 0.8.2.0 && < 0.9,
103-
test-framework-hunit >= 0.3.0.2 && < 0.4,
104-
HUnit >= 1.3.1.2 && < 1.4 || >= 1.6.0.0 && < 1.7
102+
tasty >= 1.5 && < 1.6,
103+
tasty-hunit >= 0.10 && < 0.11
105104

106105
default-language: Haskell2010

Diff for: test/BDD.hs

+6-7
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
module BDD where
55

66
import Control.Monad (ap)
7-
import Test.Framework (defaultMain, TestName, Test, testGroup)
8-
import Test.Framework.Providers.HUnit (testCase)
9-
import Test.HUnit (Assertion, (@?=))
7+
import Test.Tasty
8+
import Test.Tasty.HUnit
109

1110
#if !MIN_VERSION_base(4,8,0)
1211
import Control.Applicative (Applicative (..))
@@ -24,13 +23,13 @@ import GHC.Stack (HasCallStack)
2423
-------------------------------------------------------------------------------
2524

2625
specMain :: TestM () -> IO ()
27-
specMain t = runTestM t >>= defaultMain
26+
specMain t = runTestM t >>= defaultMain . testGroup "specs"
2827

29-
newtype TestM a = TestM { unTestM :: [Test] -> IO ([Test], a) }
28+
newtype TestM a = TestM { unTestM :: [TestTree] -> IO ([TestTree], a) }
3029
deriving (Functor)
3130

3231
-- accumulating in reverse order.
33-
tell1 :: Test -> TestM ()
32+
tell1 :: TestTree -> TestM ()
3433
tell1 t = TestM $ \ts -> return (t : ts, ())
3534

3635
instance Applicative TestM where
@@ -44,7 +43,7 @@ instance Monad TestM where
4443
(ys, x) <- unTestM m xs
4544
unTestM (k x) ys
4645

47-
runTestM :: TestM () -> IO [Test]
46+
runTestM :: TestM () -> IO [TestTree]
4847
runTestM (TestM m) = fmap (reverse . fst) (m [])
4948

5049
runIO :: IO a -> TestM a

0 commit comments

Comments
 (0)