summaryrefslogtreecommitdiff
path: root/libraries/base/tests/IO
diff options
context:
space:
mode:
authorLysxia <lysxia@gmail.com>2019-10-08 19:36:54 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-03-16 23:52:42 -0400
commit818b3c38e7548f4720815f76969238d82c9650f7 (patch)
tree33de52880f155173aed8e43cde30fed936146a71 /libraries/base/tests/IO
parentcfcc3c9a1f2e4e33bed4c40767f8e7971e331c15 (diff)
downloadhaskell-818b3c38e7548f4720815f76969238d82c9650f7.tar.gz
base: add strict IO functions: readFile', getContents', hGetContents'
Diffstat (limited to 'libraries/base/tests/IO')
-rw-r--r--libraries/base/tests/IO/all.T1
-rw-r--r--libraries/base/tests/IO/hGetContentsS001.hs8
-rw-r--r--libraries/base/tests/IO/hGetContentsS001.stdout4
3 files changed, 13 insertions, 0 deletions
diff --git a/libraries/base/tests/IO/all.T b/libraries/base/tests/IO/all.T
index 818ce67267..0ba27f1b42 100644
--- a/libraries/base/tests/IO/all.T
+++ b/libraries/base/tests/IO/all.T
@@ -20,6 +20,7 @@ test('hGetBuffering001',
[omit_ways(['ghci']), set_stdin('hGetBuffering001.hs')],
compile_and_run, [''])
+test('hGetContentsS001', normal, compile_and_run, [''])
test('hGetChar001', normal, compile_and_run, [''])
test('hGetLine001', set_stdin('hGetLine001.hs'), compile_and_run, ['-cpp'])
test('hGetLine002', normal, compile_and_run, [''])
diff --git a/libraries/base/tests/IO/hGetContentsS001.hs b/libraries/base/tests/IO/hGetContentsS001.hs
new file mode 100644
index 0000000000..be0935795e
--- /dev/null
+++ b/libraries/base/tests/IO/hGetContentsS001.hs
@@ -0,0 +1,8 @@
+import System.IO
+
+file = "hGetContentsS001.txt"
+
+main = do
+ writeFile file "ab\ncd\nef\ngh\n"
+ h <- openFile file ReadMode
+ hGetContents' h >>= putStr
diff --git a/libraries/base/tests/IO/hGetContentsS001.stdout b/libraries/base/tests/IO/hGetContentsS001.stdout
new file mode 100644
index 0000000000..7cddf5ba9e
--- /dev/null
+++ b/libraries/base/tests/IO/hGetContentsS001.stdout
@@ -0,0 +1,4 @@
+ab
+cd
+ef
+gh