Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- testSpec :: TestName -> Spec -> IO TestTree
- testSpecs :: Spec -> IO [TestTree]
- data TreatPendingAs
- module Test.Hspec
- module Test.Hspec
Tests
Options
data TreatPendingAs Source #
How 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)
.
Instances
Re-exports
module Test.Hspec
module Test.Hspec
Examples
The simplest usage of this library involves first creating a TestTree
in
IO
, then running it with defaultMain
.
main = do spec <-testSpec
"spec" mySpecdefaultMain
(testGroup
"tests" [ spec , ... ])
You can treat an pending
/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) , ... ]
However, 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 unsafePerformIO
.
main = dodefaultMain
(testGroup
"tests" [unsafePerformIO
(testSpec
"spec" mySpec) , ... ])