Represents a tripwire which can be tripped only once. It can be used to detect if a particular code path was reached.
Modulehedgehog-extras-0.10.1.0Haskell2010
Hedgehog.Extras.Test.Tripwire
This modules provides a tripwire abstraction. You can use tripwire as a detection mechanism if the code path was executed. Trip a tripwire with trip in the place where you'd like to detect if it was reached. The tripwire can then be checked in the other place in the code using for example isTripped or assertNotTripped.
Synopsis
- data Tripwire
- value makeTripwire
- value makeTripwireWithLabel
- value trip
- value trip_
- value isTripped
- value getTripSite
- value resetTripwire
- value assertNotTripped
- value assertTripped
- Packagehedgehog-extras-0.10.1.0
- Exports10
- LanguageHaskell2010
- LicenceApache-2.0
- SourceTripwire.hs
Create a tripwire
Creates a new tripwire
Creates a new tripwire with a label, which is visible when showed: Tripwire mylabel
Tripwire operations
Triggers the tripwire and registers the place of the first trigger. Idempotent. Prints the information in the test log about tripping the tripwire.
Check if the tripwire was tripped.
Return the call stack, where the tripwire was tripped - if it was tripped.
Restore tripwire to initial non triggered state
Assertions
Fails the test if the tripwire was triggered. Prints the call stack where the tripwire was triggered.
Fails the test if the tripwire was not triggered yet.