[commit: stm] master: add test for cloneTChan (e17f742)
Simon Marlow
marlowsd at gmail.com
Mon Feb 18 12:02:10 CET 2013
Repository : ssh://darcs.haskell.org//srv/darcs/packages/stm
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/e17f742f446eea0894d164b208d25bafee80bd28
>---------------------------------------------------------------
commit e17f742f446eea0894d164b208d25bafee80bd28
Author: Simon Marlow <marlowsd at gmail.com>
Date: Mon Feb 18 11:01:55 2013 +0000
add test for cloneTChan
>---------------------------------------------------------------
tests/all.T | 2 ++
tests/cloneTChan001.hs | 11 +++++++++++
tests/cloneTChan001.stdout | 4 ++++
3 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/tests/all.T b/tests/all.T
index 07383d8..a5dc1e6 100644
--- a/tests/all.T
+++ b/tests/all.T
@@ -41,3 +41,5 @@ test('3049', normal, compile_and_run, ['-package stm'])
test('4057', normal, compile_and_run, ['-package stm'])
test('stm064', normal, compile_and_run, ['-package stm'])
test('stm065', normal, compile_and_run, ['-package stm'])
+
+test('cloneTChan001', normal, compile_and_run, ['-package stm'])
diff --git a/tests/cloneTChan001.hs b/tests/cloneTChan001.hs
new file mode 100644
index 0000000..cc8e0e5
--- /dev/null
+++ b/tests/cloneTChan001.hs
@@ -0,0 +1,11 @@
+import Control.Concurrent.STM
+
+main = do
+ c <- newTChanIO
+ atomically $ writeTChan c 'a'
+ c1 <- atomically $ cloneTChan c
+ atomically (readTChan c) >>= print
+ atomically (readTChan c1) >>= print
+ atomically (writeTChan c 'b')
+ atomically (readTChan c) >>= print
+ atomically (readTChan c1) >>= print
diff --git a/tests/cloneTChan001.stdout b/tests/cloneTChan001.stdout
new file mode 100644
index 0000000..febc609
--- /dev/null
+++ b/tests/cloneTChan001.stdout
@@ -0,0 +1,4 @@
+'a'
+'a'
+'b'
+'b'
More information about the ghc-commits
mailing list