[macruby-changes] [3462] MacRuby/trunk/test_vm/gc.rb

source_changes at macosforge.org source_changes at macosforge.org
Tue Feb 9 14:42:45 PST 2010


Revision: 3462
          http://trac.macosforge.org/projects/ruby/changeset/3462
Author:   lsansonetti at apple.com
Date:     2010-02-09 14:42:43 -0800 (Tue, 09 Feb 2010)
Log Message:
-----------
added some TLC tests

Added Paths:
-----------
    MacRuby/trunk/test_vm/gc.rb

Added: MacRuby/trunk/test_vm/gc.rb
===================================================================
--- MacRuby/trunk/test_vm/gc.rb	                        (rev 0)
+++ MacRuby/trunk/test_vm/gc.rb	2010-02-09 22:42:43 UTC (rev 3462)
@@ -0,0 +1,39 @@
+# Testing the TLC.
+
+assert 'true', %{
+  s = nil
+  Thread.new {
+    s = [1,2,3,4,5]
+    GC.start
+  }.join
+  p s == [1,2,3,4,5]
+}
+
+assert 'true', %{
+  s = nil
+  Thread.new {
+    1.times { s = [1,2,3,4,5]; GC.start }
+  }.join
+  p s == [1,2,3,4,5]
+}
+
+assert 'true', %{
+  def foo
+    Thread.new { yield }.join
+  end
+  s = nil
+  foo { s = [1,2,3,4,5]; GC.start }
+  p s == [1,2,3,4,5]
+}
+
+assert 'true', %{
+  def bar
+    Thread.new { yield }.join
+  end
+  def foo
+    bar { yield }
+  end
+  s = nil
+  foo { s = [1,2,3,4,5]; GC.start }
+  p s == [1,2,3,4,5]
+}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100209/8733e3c7/attachment-0001.html>


More information about the macruby-changes mailing list