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