[macruby-changes] [1384] MacRuby/branches/experimental/test_vm

source_changes at macosforge.org source_changes at macosforge.org
Mon Apr 6 05:16:20 PDT 2009


Revision: 1384
          http://trac.macosforge.org/projects/ruby/changeset/1384
Author:   vincent.isambart at gmail.com
Date:     2009-04-06 05:16:19 -0700 (Mon, 06 Apr 2009)
Log Message:
-----------
added a failing test for eval and two for catchs

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

Added Paths:
-----------
    MacRuby/branches/experimental/test_vm/catch.rb

Added: MacRuby/branches/experimental/test_vm/catch.rb
===================================================================
--- MacRuby/branches/experimental/test_vm/catch.rb	                        (rev 0)
+++ MacRuby/branches/experimental/test_vm/catch.rb	2009-04-06 12:16:19 UTC (rev 1384)
@@ -0,0 +1,24 @@
+assert ':ok', %{
+  catch(:x) do
+    begin
+      catch(:x) do
+        raise ''
+      end
+    rescue
+    end
+    throw :x
+    p :ko
+  end
+  p :ok
+}
+
+assert ':ok', %{
+  def foo
+    catch(:x) do
+      1.times { return }
+    end
+    p :ko
+  end
+  catch(:x) do foo(); throw :x; end
+  p :ok
+}

Modified: MacRuby/branches/experimental/test_vm/eval.rb
===================================================================
--- MacRuby/branches/experimental/test_vm/eval.rb	2009-04-06 09:31:22 UTC (rev 1383)
+++ MacRuby/branches/experimental/test_vm/eval.rb	2009-04-06 12:16:19 UTC (rev 1384)
@@ -54,5 +54,7 @@
 
 assert "42", "class A; def foo; @x; end; end; x = A.new; x.instance_eval { @x = 42 }; p x.foo"
 
+assert "42", "b = binding; eval('x = 42', b); eval('p x', b)"
+
 assert ":ok", "module M; module_eval 'p :ok'; end"
 assert ":ok", "module M; module_eval 'def self.foo; :ok; end'; end; p M.foo"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090406/cc0eed8f/attachment.html>


More information about the macruby-changes mailing list