Moduletasty-hspec-1.2.0.4Haskell2010
Test.Tasty.Hspec
hspec and tasty serve similar purposes; consider using one or the
other.
However, in a pinch, this module allows you to run an hspec H.Spec as a
tasty T.TestTree.
- 1 type
- 2 values
- Packagetasty-hspec-1.2.0.4
- Exports3
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceHspec.hs
Tests
2 declarationsOptions
1 declarationHow to treat hspec pending tests.
tasty does not have the concept of pending tests, so we must map them to
either successes or failures. By default, they are treated as failures.
Set via the command line flag --treat-pending-as (success|failure).
Constructors
Instances1IsOption
IsOption TreatPendingAsDefined in tasty-hspec-1.2.0.4 · Test.Tasty.Hspec
Examples
0 declarationsThe simplest usage of this library involves first creating a T.TestTree in IO, then running it with
T.defaultMain.
main = do
spec <- testSpec "spec" mySpec
T.defaultMain
(T.testGroup "tests"
[ spec
, ...
])
You can treat an H.pending/H.pendingWith test as a success instead of a
failure (the default):
tests :: TestTree
tests =
localOption TreatPendingAsSuccess $ testGroup "My Hspec TestTree"
[ unsafePerformIO (testSpec "My first Hspec test" spec_firstHspecTest)
, ...
]
If you don't do any IO during Spec creation, or the IO need
not be performed at any particular time relative to other IO actions, it's
perfectly fine to use System.IO.unsafePerformIO.
main = do
T.defaultMain
(T.testGroup "tests"
[ System.IO.unsafePerformIO (testSpec "spec" mySpec)
, ...
])