Revision
3462
Author
lsansonetti@apple.com
Date
2010-02-09 14:42:43 -0800 (Tue, 09 Feb 2010)

Log Message

added some TLC tests

Added Paths

Diff

Added: MacRuby/trunk/test_vm/gc.rb (0 => 3462)


--- 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]
+}