[MLton-commit] r4048

Stephen Weeks MLton@mlton.org
Sat, 27 Aug 2005 13:40:51 -0700


Added another MLton.finalizable regression.


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

A   mlton/trunk/regression/finalize.5.ok
A   mlton/trunk/regression/finalize.5.sml

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

Added: mlton/trunk/regression/finalize.5.ok
===================================================================
--- mlton/trunk/regression/finalize.5.ok	2005-08-27 04:28:23 UTC (rev 4047)
+++ mlton/trunk/regression/finalize.5.ok	2005-08-27 20:40:49 UTC (rev 4048)
@@ -0,0 +1,6 @@
+before test 6
+before GC 6
+after GC 6
+before GC 6a
+test 6: finalizer
+after GC 6a

Added: mlton/trunk/regression/finalize.5.sml
===================================================================
--- mlton/trunk/regression/finalize.5.sml	2005-08-27 04:28:23 UTC (rev 4047)
+++ mlton/trunk/regression/finalize.5.sml	2005-08-27 20:40:49 UTC (rev 4048)
@@ -0,0 +1,18 @@
+fun test (str : string) =
+    let open MLton.Finalizable
+        val x = new str
+        exception Exit
+    in addFinalizer (x, fn s => print (s ^ ": finalizer\n"));
+       withValue (x, fn s =>
+                        (print "before GC 6\n";
+                         MLton.GC.collect ();
+                         print "after GC 6\n";
+                         raise Exit))
+       handle Exit => ()
+    end
+
+val _ = (print "before test 6\n";
+         test "test 6";
+         print "before GC 6a\n";
+         MLton.GC.collect ();
+         print "after GC 6a\n")