diff options
Diffstat (limited to 'testsuite/tests/lib/IO/hGetBuffering001.hs')
-rw-r--r-- | testsuite/tests/lib/IO/hGetBuffering001.hs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/lib/IO/hGetBuffering001.hs b/testsuite/tests/lib/IO/hGetBuffering001.hs new file mode 100644 index 0000000000..83188b2796 --- /dev/null +++ b/testsuite/tests/lib/IO/hGetBuffering001.hs @@ -0,0 +1,21 @@ +import System.IO + +main = + sequence (map hIsOpen [stdin, stdout, stderr]) >>= \ opens -> + print opens >> + sequence (map hIsClosed [stdin, stdout, stderr]) >>= \ closeds -> + print closeds >> + sequence (map hIsReadable [stdin, stdout, stderr]) >>= \ readables -> + print readables >> + sequence (map hIsWritable [stdin, stdout, stderr]) >>= \ writables -> + print writables >> + sequence (map hIsBlockBuffered [stdin, stdout, stderr]) >>= \ buffereds -> + print buffereds >> + sequence (map hIsLineBuffered [stdin, stdout, stderr]) >>= \ buffereds -> + print buffereds >> + sequence (map hIsNotBuffered [stdin, stdout, stderr]) >>= \ buffereds -> + print buffereds + where + hIsBlockBuffered h = hGetBuffering h >>= \ b -> return $ case b of { BlockBuffering _ -> True; _ -> False } + hIsLineBuffered h = hGetBuffering h >>= \ b -> return $ case b of { LineBuffering -> True; _ -> False } + hIsNotBuffered h = hGetBuffering h >>= \ b -> return $ case b of { NoBuffering -> True; _ -> False } |