File: test002-writefile.hs

package info (click to toggle)
haskell-hinotify 0.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 112 kB
  • sloc: haskell: 245; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 691 bytes parent folder | download | duplicates (5)
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
{-# LANGUAGE OverloadedStrings #-}
module Main where

import Control.Monad

import qualified Data.ByteString as B

import System.INotify as INotify

import Utils

write :: FilePath -> IO ()
write path =
    B.writeFile (path ++ "/hello") ""
    -- actually writing any contents gives me two Modified
    
main :: IO ()
main =
    inTestEnviron [AllEvents] write $ \ events -> do
        when (expected ~= events)
            testSuccess
        putStrLn $ explainFailure expected events
        testFailure

expected :: [Event]
expected =
    [ Created   False "hello"
    , Opened    False (Just "hello")
    , Modified  False (Just "hello")
    , Closed    False (Just "hello") True
    ]