summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/lib/IO/ioeGetHandle001.hs
blob: a9ef58a8ca5bdedbbbb900b7dcc369e4202889fc (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 ()) `catch`
	\e -> if isEOFError e && fromJust (ioeGetHandle e) == h
		then putStrLn "ok."
		else putStrLn "failed."