feat[tests]: Use tasty for hierarchical tests
This commit is contained in:
parent
0d8470a87f
commit
766528677f
4 changed files with 25 additions and 9 deletions
|
@ -22,6 +22,7 @@ default-extensions:
|
|||
- DerivingStrategies
|
||||
- ImportQualifiedPost
|
||||
- NoImplicitPrelude
|
||||
- OverloadedStrings
|
||||
- StandaloneKindSignatures
|
||||
- RoleAnnotations
|
||||
|
||||
|
@ -60,3 +61,5 @@ tests:
|
|||
- -with-rtsopts=-N
|
||||
dependencies:
|
||||
- scalie
|
||||
- tasty
|
||||
- tasty-quickcheck
|
||||
|
|
|
@ -33,6 +33,7 @@ library
|
|||
DerivingStrategies
|
||||
ImportQualifiedPost
|
||||
NoImplicitPrelude
|
||||
OverloadedStrings
|
||||
StandaloneKindSignatures
|
||||
RoleAnnotations
|
||||
ghc-options: -Weverything -Wno-unsafe
|
||||
|
@ -54,6 +55,7 @@ executable scalie-exe
|
|||
DerivingStrategies
|
||||
ImportQualifiedPost
|
||||
NoImplicitPrelude
|
||||
OverloadedStrings
|
||||
StandaloneKindSignatures
|
||||
RoleAnnotations
|
||||
ghc-options: -Weverything -Wno-unsafe -threaded -rtsopts -with-rtsopts=-N
|
||||
|
@ -79,6 +81,7 @@ test-suite scalie-test
|
|||
DerivingStrategies
|
||||
ImportQualifiedPost
|
||||
NoImplicitPrelude
|
||||
OverloadedStrings
|
||||
StandaloneKindSignatures
|
||||
RoleAnnotations
|
||||
ghc-options: -Weverything -Wno-unsafe -threaded -rtsopts -with-rtsopts=-N
|
||||
|
@ -87,6 +90,8 @@ test-suite scalie-test
|
|||
, base
|
||||
, containers
|
||||
, scalie
|
||||
, tasty
|
||||
, tasty-quickcheck
|
||||
, text
|
||||
, vector
|
||||
default-language: Haskell2010
|
||||
|
|
11
test/Spec.hs
11
test/Spec.hs
|
@ -1,9 +1,12 @@
|
|||
{-# LANGUAGE Unsafe #-} -- unsafe: Uses functions imported from unsafe modules
|
||||
import System.IO (IO)
|
||||
import Control.Applicative (pure)
|
||||
import Test.Data.Map.Implicit qualified
|
||||
import Test.Tasty qualified as Tasty
|
||||
import Data.Function (($))
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
_ <- Test.Data.Map.Implicit.runTests
|
||||
pure ()
|
||||
main = Tasty.defaultMain $ Tasty.testGroup "all"
|
||||
[ Tasty.testGroup "Properties"
|
||||
[ Test.Data.Map.Implicit.testGroup
|
||||
]
|
||||
]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{-# LANGUAGE TemplateHaskell #-} -- for 'quickCheckAll'
|
||||
{-# OPTIONS_GHC -Wno-all-missed-specialisations #-} -- a lot of warnings for unspecialized 'read' and 'show', which I cannot specialize
|
||||
-- I wouldn't know how at least, they're not my datatypes, I cannot use the hint and add an 'INLINABLE' pragma
|
||||
module Test.Data.Map.Implicit (prop_readShowIdentityRoundtrip, prop_readShowMaybeRoundtrip, runTests) where
|
||||
module Test.Data.Map.Implicit (testGroup) where
|
||||
import Test.QuickCheck.Roundtrip (roundtrips)
|
||||
import Text.Show (show)
|
||||
import Text.Read (read)
|
||||
|
@ -10,10 +10,12 @@ import Data.Map.Implicit (ImplicitMap)
|
|||
import Data.Bool (Bool)
|
||||
import Language.Scalie.Ast.Definition (Definition)
|
||||
import Data.Functor.Identity (Identity)
|
||||
import Test.QuickCheck.All (quickCheckAll)
|
||||
import System.IO (IO)
|
||||
import Test.QuickCheck (Property, allProperties)
|
||||
import Data.String (String)
|
||||
import Control.Applicative (pure)
|
||||
import Data.Maybe (Maybe)
|
||||
import Test.Tasty.QuickCheck qualified as Tasty.QuickCheck
|
||||
import Test.Tasty (TestTree)
|
||||
|
||||
-- | This is testworthy since I have somehow hand-hacked the read/show de/serialization of 'ImplicitMap'
|
||||
|
||||
|
@ -24,5 +26,8 @@ prop_readShowMaybeRoundtrip :: ImplicitMap (Definition Maybe) -> Bool
|
|||
prop_readShowMaybeRoundtrip = roundtrips read show
|
||||
|
||||
pure []
|
||||
runTests :: IO Bool
|
||||
runTests = $quickCheckAll
|
||||
allTests :: [(String, Property)]
|
||||
allTests = $allProperties
|
||||
|
||||
testGroup :: TestTree
|
||||
testGroup = Tasty.QuickCheck.testProperties "Data.Map.Implicit" allTests
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue