|
| 1 | +{-# LANGUAGE AllowAmbiguousTypes #-} |
1 | 2 | {-# LANGUAGE CPP #-} |
2 | 3 | {-# LANGUAGE BangPatterns #-} |
3 | 4 | {-# LANGUAGE FlexibleContexts #-} |
@@ -80,6 +81,7 @@ main = do |
80 | 81 | let ![[Nothing, Nothing]] = os6 -- TODO re-enable this test after issue #233 has been resolved |
81 | 82 | let !(Just [(-9223372036854775808,"2")]) = M.toList <$> head (head os7) |
82 | 83 | let !(Just [(-9223372036854775808,"dcba")]) = M.toList <$> head (head os8) |
| 84 | + let ![[Nothing,Just "0:1"],[Nothing,Just "1:2"],[Nothing,Just "2:3"]] = os9 |
83 | 85 | return () |
84 | 86 |
|
85 | 87 | unwrapApp :: forall t m a. |
@@ -241,17 +243,26 @@ testMatchRequestsWithResponses pulse = mdo |
241 | 243 | , \x -> has @Read r $ readMaybe x |
242 | 244 | ) |
243 | 245 |
|
244 | | --- If a widget is destroyed, and simultaneously it tries to use performEvent, the event shouldn't be performed. |
| 246 | +-- If a widget is destroyed, and simultaneously it tries to use performEvent, the event does not get performed. |
| 247 | +-- TODO Determine whether this is actually the behavior we want. |
245 | 248 | testMoribundPerformEvent |
246 | | - :: ( Adjustable t m |
| 249 | + :: forall t m |
| 250 | + . ( Adjustable t m |
247 | 251 | , PerformEvent t m |
248 | 252 | , MonadIO (Performable m) |
| 253 | + , MonadHold t m |
| 254 | + , Reflex t |
249 | 255 | ) |
250 | | - => Event t Int -> m (Event t ()) |
| 256 | + => Event t Int -> m (Event t String) |
251 | 257 | testMoribundPerformEvent pulse = do |
252 | | - runWithReplace (performEvent $ liftIO . print <$> pulse) $ ffor pulse $ \i -> do |
253 | | - performEvent $ liftIO . print <$> pulse |
254 | | - pure () |
255 | | - pure never |
| 258 | + (outputInitial, outputReplaced) <- runWithReplace (performPrint 0 pulse) $ ffor pulse $ \i -> performPrint i pulse |
| 259 | + switchHold outputInitial outputReplaced |
| 260 | + where |
| 261 | + performPrint i evt = |
| 262 | + let outputEvt = ((show i <> ":") <>) . show <$> evt |
| 263 | + in performEvent $ ffor outputEvt $ \output -> |
| 264 | + let msg = show i <> ":" <> show output |
| 265 | + in return output |
| 266 | + |
256 | 267 |
|
257 | 268 | deriveArgDict ''TestRequest |
0 commit comments