[macruby-changes] [1507] MacRuby/branches/experimental/test_vm/exception.rb

source_changes at macosforge.org source_changes at macosforge.org
Thu Apr 30 16:06:00 PDT 2009


Revision: 1507
          http://trac.macosforge.org/projects/ruby/changeset/1507
Author:   vincent.isambart at gmail.com
Date:     2009-04-30 16:06:00 -0700 (Thu, 30 Apr 2009)
Log Message:
-----------
added failing tests for ensure

Modified Paths:
--------------
    MacRuby/branches/experimental/test_vm/exception.rb

Modified: MacRuby/branches/experimental/test_vm/exception.rb
===================================================================
--- 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
+}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090430/fc0cd948/attachment.html>


More information about the macruby-changes mailing list