summaryrefslogtreecommitdiff
path: root/libraries/base/tests/IO/ioeGetHandle001.hs
blob: 08934468e43c85e64a0edc40e59f506e1bc665b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
-- !!! test ioeGetHandle

import System.IO
import System.IO.Error
import Data.Maybe

main = do
  h <- openFile "ioeGetHandle001.hs" ReadMode
  hSeek h SeekFromEnd 0
  (hGetChar h >> return ()) `catchIOError`
        \e -> if isEOFError e && fromJust (ioeGetHandle e) == h
                then putStrLn "ok."
                else putStrLn "failed."