File: test003-removefile.hs

package info (click to toggle)
haskell-hinotify 0.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 144 kB
  • sloc: haskell: 271; sh: 25; makefile: 6
file content (35 lines) | stat: -rw-r--r-- 625 bytes parent folder | download | duplicates (2)
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
module Main where

import Control.Monad

import System.Directory

import System.INotify as INotify

import Utils

file = "hello"

write path = do
    writeFile (path ++ '/':file) ""

remove path = do
    removeFile (path ++ '/':file)

action path = do
    write path
    remove path
    
main =
    inTestEnviron [AllEvents] action $ \ events -> do
        when (expected ~= events)
            testSuccess
        explainFailure expected events

expected =
    [ Created   False file
    , Opened    False (Just file)
    , Modified  False (Just file)
    , Closed    False (Just file) True
    , Deleted   False file
    ]