File: ReaperSpec.hs

package info (click to toggle)
haskell-auto-update 0.1.6-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 112 kB
  • sloc: haskell: 373; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 1,011 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
module Control.ReaperSpec (spec) where

import Control.Concurrent
import Control.Reaper
import Data.IORef
import Test.Hspec
import Test.Hspec.QuickCheck


spec :: Spec
spec = return ()
--   prop "works" $ \is -> do
--     reaper <- mkReaper defaultReaperSettings
--         { reaperAction = action
--         , reaperDelay = 1000
--         }

--     let mkTestCase i = do
--             ref <- newIORef 0
--             let expected = (abs i `mod` 10) + 1
--             reaperAdd reaper (expected, ref)
--             return (expected, ref)
--     testCases <- mapM mkTestCase is

--     let test (expected, ref) = do
--             actual <- readIORef ref
--             actual `shouldBe` (expected :: Int)
--     threadDelay 100000
--     mapM_ test testCases
--     [] <- reaperRead reaper
--     return ()

-- type Item = (Int, IORef Int)

-- action = mkListAction $ \(i, ref) -> do
--     modifyIORef ref succ
--     return $ if i > 1
--              then Just (pred i, ref)
--              else Nothing