Revision
1507
Author
vincent.isambart@gmail.com
Date
2009-04-30 16:06:00 -0700 (Thu, 30 Apr 2009)

Log Message

added failing tests for ensure

Modified Paths

Diff

Modified: MacRuby/branches/experimental/test_vm/exception.rb (1506 => 1507)


--- MacRuby/branches/experimental/test_vm/exception.rb	2009-04-30 10:54:05 UTC (rev 1506)
+++ MacRuby/branches/experimental/test_vm/exception.rb	2009-04-30 23:06:00 UTC (rev 1507)
@@ -108,3 +108,28 @@
 }
 
 assert ":ok", "1.times { x = foo rescue nil; }; p :ok"
+
+# the code inside an ensure is even executed
+# if we leave the ensure block with a throw
+assert ':ok', %{
+  catch(:a) do
+    begin
+      throw :a
+    ensure
+      p :ok
+    end
+  end  
+}
+
+# the code inside an ensure is even executed
+# if we leave the ensure block with a return
+assert ':ok', %{
+  def foo
+    begin
+      return
+    ensure
+      p :ok
+    end
+  end
+  foo
+}