summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-12-09 14:41:17 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-12-10 19:58:19 -0500
commit8dd9929ad29fd200405d068463af64dafff6b402 (patch)
tree0451c85dbec8e3b30b861d9a82bdb7ef0f0e5b2b
parent7a823b0ffcbd5b5c4c03334e72c8a36460b62ff7 (diff)
downloadhaskell-8dd9929ad29fd200405d068463af64dafff6b402.tar.gz
testsuite: Add (broken) test for #17510
-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, [''])