Skip to content

Commit 49b30f6

Browse files
committed
io-sim: refactored prop_registerDelayCancellable tests
1 parent 694d034 commit 49b30f6

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

io-sim/test/Test/Control/Monad/IOSim.hs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,9 @@ tests =
172172
-- scheduler works the way it does.
173173
, testGroup "MonadTimerCancellable"
174174
[ testProperty "registerDelayCancellable (IOSim impl)"
175-
(prop_registerDelayCancellable registerDelayCancellable)
175+
prop_registerDelayCancellable_IOSim
176176
, testProperty "registerDelayCancellable (IO impl)"
177-
(prop_registerDelayCancellable $
178-
defaultRegisterDelayCancellable
179-
(newTimeout . microsecondsAsIntToDiffTime)
180-
readTimeout
181-
cancelTimeout
182-
awaitTimeout
183-
)
177+
prop_registerDelayCancellable_IO
184178
]
185179
]
186180

@@ -1335,6 +1329,25 @@ prop_registerDelayCancellable registerDelayCancellableImpl
13351329
|| tv == TimeoutCancelled)
13361330
| otherwise -> (Just tv, tv == TimeoutCancelled)
13371331

1332+
1333+
1334+
-- | Both tests run in `IOSim`, they only differ with the implementation of
1335+
-- `registerDelayCancellable`
1336+
--
1337+
prop_registerDelayCancellable_IOSim, prop_registerDelayCancellable_IO
1338+
:: DelayWithCancel -> Property
1339+
1340+
prop_registerDelayCancellable_IOSim =
1341+
prop_registerDelayCancellable registerDelayCancellable
1342+
1343+
prop_registerDelayCancellable_IO =
1344+
prop_registerDelayCancellable $
1345+
defaultRegisterDelayCancellable
1346+
(newTimeout . microsecondsAsIntToDiffTime)
1347+
readTimeout
1348+
cancelTimeout
1349+
awaitTimeout
1350+
13381351
--
13391352
-- Utils
13401353
--

0 commit comments

Comments
 (0)