0.x to 1.x
dejafu-1.0.0.0 is a super-major release which breaks compatibility with dejafu-0.x quite significantly, but brings with it support for bound threads, and significantly improves memory usage in the general case.
Highlights reel:
- Most predicates now only need to keep around the failures, rather than all results.
- Support for bound threads (with concurrency-1.3.0.0).
- The
ST
/IO
interface duplication is gone, everything is now monadic. - Function parameter order is closer to other testing libraries.
- Much improved API documentation.
See the changelogs for the full details.
ST
and IO
functions
There is only one set of functions now. Testing bound threads requires being
able to fork actual threads, so testing with ST
is no longer possible. The
ConcST
type is gone, there is only ConcIO
.
For dejafu change:
autocheckIO
toautocheck
dejafuIO
todejafu
dejafusIO
todejafus
autocheckWayIO
toautocheckWay
dejafuWayIO
todejafuWay
dejafusWayIO
todejafusWay
dejafuDiscardIO
todejafuDiscard
runTestM
torunTest
runTestWayM
torunTestWay
If you relied on being able to get a pure result from the ConcST
functions,
you can no longer do this.
For hunit-dejafu and tasty-dejafu change:
testAutoIO
totestAuto
testDejafuIO
totestDejafu
testDejafusIO
totestDejafus
testAutoWayIO
totestAutoWay
testDejafuWayIO
totestDejafuWay
testDejafusWayIO
totestDejafusWay
testDejafuDiscardIO
totestDejafuDiscard
Function parameter order
Like HUnit, the monadic action to test is now the last parameter of the testing functions. This makes it convenient to write tests without needing to define the action elsewhere.
For dejafu change:
dejafu ma (s, p)
todejafu s p ma
dejafus ma ps
todejafus ps ma
dejafuWay way mem ma (s, p)
todejafuWay way mem s p ma
dejafusWay way mem ma ps
todejafuWay way mem ps ma
dejafuDiscard d way mem ma (s, p)
todejafuDiscard d way mem s p ma
For hunit-dejafu and tasty-dejafu change:
testDejafu ma s p
totestDejafu s p ma
testDejafus ma ps
totestDejafus ps ma
testDejafuWay way mem ma s p
totestDejafuWay way mem s p ma
testDejafusWay way mem ma ps
totestDejafusWay way mem ps ma
testDejafuDiscard d way mem ma s p
totestDejafuDiscard d way mem s p ma
Predicates
The Predicate a
type is now an alias for ProPredicate a a
, defined like so:
data ProPredicate a b = ProPredicate
{ pdiscard :: Either Failure a -> Maybe Discard
-- ^ Selectively discard results before computing the result.
, peval :: [(Either Failure a, Trace)] -> Result b
-- ^ Compute the result with the un-discarded results.
}
If you use the predicate helper functions to construct a predicate, you do not need to change anything (and should get a nice reduction in your resident memory usage). If you supply a function directly, you can recover the old behaviour like so:
old :: ([(Either Failure a, Trace)] -> Result a) -> ProPredicate a a
old p = ProPredicate
{ pdiscard = const Nothing
, peval = p
}
The alwaysTrue2
helper function is gone. If you use it, use alwaysSameOn
or
alwaysSameBy
instead.
Need help?
- For general help talk to me in IRC (barrucadu in #haskell) or shoot me an email (mike@barrucadu.co.uk)
- For bugs, issues, or requests, please file an issue.