summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-12-09 14:41:17 -0500
committerBen Gamari <ben@smart-cactus.org>2019-12-09 14:56:01 -0500
commit6afe81129c89d8bf34e3450c188e87ed108a00b2 (patch)
tree5099394613b17c140cd6e7cb04eb7dcaf0168b07
parentd46a72e19e1b508358827e7270139f3273915697 (diff)
downloadhaskell-wip/T17510.tar.gz
testsuite: Add (broken) test for #17510wip/T17510
-rw-r--r--libraries/base/tests/IO/T17510.hs15
-rw-r--r--libraries/base/tests/IO/T17510.stdout4
-rw-r--r--libraries/base/tests/IO/all.T1
3 files changed, 20 insertions, 0 deletions
diff --git a/libraries/base/tests/IO/T17510.hs b/libraries/base/tests/IO/T17510.hs
new file mode 100644
index 0000000000..a291855a42
--- /dev/null
+++ b/libraries/base/tests/IO/T17510.hs
@@ -0,0 +1,15 @@
+-- | Test that a handle from 'hDuplicate' really shares the file position with
+-- its parent.
+
+import System.IO
+import GHC.IO.Handle
+
+main :: IO ()
+main = do
+ writeFile "test" "hello\nworld\ntesting\n"
+ h <- openFile "test" ReadMode
+ h2 <- hDuplicate h
+ hGetLine h >>= putStrLn -- should print "hello"
+ hGetLine h2 >>= putStrLn -- should print "world"
+ hGetLine h >>= putStrLn -- should print "testing"
+
diff --git a/libraries/base/tests/IO/T17510.stdout b/libraries/base/tests/IO/T17510.stdout
new file mode 100644
index 0000000000..23e60981b1
--- /dev/null
+++ b/libraries/base/tests/IO/T17510.stdout
@@ -0,0 +1,4 @@
+hello
+world
+testing
+
diff --git a/libraries/base/tests/IO/all.T b/libraries/base/tests/IO/all.T
index bfc6a090e9..189fbebb88 100644
--- a/libraries/base/tests/IO/all.T
+++ b/libraries/base/tests/IO/all.T
@@ -142,3 +142,4 @@ test('T17414',
when(opsys('linux'), skip),
high_memory_usage],
compile_and_run, [''])
+test('T17510', expect_broken(17510), compile_and_run, [''])