From: Niklas Hambuechen <[email protected]> This makes our test compile with out errors with QuickCheck 2.7. Warnings about the deprecation of printTestCase remain when using 2.7.
This change is backwards-compatible with all older versions of QuickCheck that we support. In 2.7, Property is no longer a monad, but remains a `Gen Prop` inside, so that we only have to use combinations of `property` and `return` to become compatible. See https://hackage.haskell.org/package/QuickCheck-2.7.6/changelog Further, in QuickCheck 2.7, Positive/NonZero/NonNegative are no longer instances of `Integral` (NonNegative could likely still be one, see https://github.com/nick8325/quickcheck/issues/31). Consequently we cannot create them using `fromIntegral` any more, and switch to `fromEnum` instead, which also is backwards-compatible. Signed-off-by: Niklas Hambuechen <[email protected]> Reviewed-by: Klaus Aehlig <[email protected]> Cherry-picked-from: 4320ba1dcfe49b659abbc46a6cf37e6a4db66f22 Signed-off-by: Petr Pudlak <[email protected]> --- test/hs/Test/Ganeti/JQScheduler.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/hs/Test/Ganeti/JQScheduler.hs b/test/hs/Test/Ganeti/JQScheduler.hs index 273a250..9430495 100644 --- a/test/hs/Test/Ganeti/JQScheduler.hs +++ b/test/hs/Test/Ganeti/JQScheduler.hs @@ -155,8 +155,10 @@ prop_slotMapFromJob_conflicting_buckets = do (lab2, _ ) <- parseReasonRateLimit s2 let sm = Map.fromList [(lab1, Slot 1 lim1)] cm = Map.fromList [(lab2, 1)] - in (sm `occupySlots` cm) ==? Map.fromList [ (lab1, Slot 1 lim1) - , (lab2, Slot 1 0) ] + in return $ + (sm `occupySlots` cm) ==? Map.fromList [ (lab1, Slot 1 lim1) + , (lab2, Slot 1 0) + ] :: Gen Property -- | Tests some basic cases for reason rate limiting. @@ -257,12 +259,12 @@ prop_reasonRateLimit = -- | Tests that filter rule ordering is determined (solely) by priority, -- watermark and UUID, as defined in `doc/design-optables.rst`. prop_filterRuleOrder :: Property -prop_filterRuleOrder = do +prop_filterRuleOrder = property $ do a <- arbitrary b <- arbitrary `suchThat` ((frUuid a /=) . frUuid) - filterRuleOrder a b ==? (frPriority a, frWatermark a, frUuid a) - `compare` - (frPriority b, frWatermark b, frUuid b) + return $ filterRuleOrder a b ==? (frPriority a, frWatermark a, frUuid a) + `compare` + (frPriority b, frWatermark b, frUuid b) -- | Tests common inputs for `matchPredicate`, especially the predicates -- 2.4.3.573.g4eafbef
