[MLton-commit] r5355

Vesa Karvonen vesak at mlton.org
Tue Feb 27 13:13:15 PST 2007


A Mailbox test.
----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/async/unstable/test/async.sml

----------------------------------------------------------------------

Modified: mltonlib/trunk/com/ssh/async/unstable/test/async.sml
===================================================================
--- mltonlib/trunk/com/ssh/async/unstable/test/async.sml	2007-02-27 20:37:22 UTC (rev 5354)
+++ mltonlib/trunk/com/ssh/async/unstable/test/async.sml	2007-02-27 21:13:03 UTC (rev 5355)
@@ -51,7 +51,7 @@
                  ; runAll () ; eq (!n, 2)
                 end))
 
-      (title "Async.Event.choose")
+      (title "Async.choose")
 
       (test (fn () => let
                    open Mailbox
@@ -71,6 +71,25 @@
                  ; runAll () ; eq (!n, 3)
                 end))
 
+      (title "Async.Mailbox")
+
+      (test (fn () => let
+                   open Mailbox
+                   val b = new ()
+                   val s = ref []
+                in
+                   send b 1
+                 ; send b 2
+                 ; when (take b, push s) ; runAll ()
+                 ; when (take b, push s)
+                 ; when (take b, push s) ; runAll ()
+                 ; send b 3
+                 ; send b 4
+                 ; send b 5
+                 ; every (take b, push s) ; runAll ()
+                 ; eql (!s, [5,4,3,2,1])
+                end))
+
       (title "Async.Multicast")
 
       (test (fn () => let




More information about the MLton-commit mailing list