add test for cloneTChan
authorSimon Marlow <marlowsd@gmail.com>
Mon, 18 Feb 2013 11:01:55 +0000 (11:01 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Mon, 18 Feb 2013 11:01:55 +0000 (11:01 +0000)
tests/all.T
tests/cloneTChan001.hs [new file with mode: 0644]
tests/cloneTChan001.stdout [new file with mode: 0644]

index 07383d8..a5dc1e6 100644 (file)
@@ -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 (file)
index 0000000..cc8e0e5
--- /dev/null
@@ -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 (file)
index 0000000..febc609
--- /dev/null
@@ -0,0 +1,4 @@
+'a'
+'a'
+'b'
+'b'