[macruby-changes] [919] MacRuby/branches/experimental/test_roxor.rb
source_changes at macosforge.org
source_changes at macosforge.org
Sat Mar 14 01:00:48 PDT 2009
Revision: 919
http://trac.macosforge.org/projects/ruby/changeset/919
Author: vincent.isambart at gmail.com
Date: 2009-03-14 01:00:47 -0700 (Sat, 14 Mar 2009)
Log Message:
-----------
new failing tests for the dispatch
Modified Paths:
--------------
MacRuby/branches/experimental/test_roxor.rb
Modified: MacRuby/branches/experimental/test_roxor.rb
===================================================================
--- MacRuby/branches/experimental/test_roxor.rb 2009-03-14 04:35:16 UTC (rev 918)
+++ MacRuby/branches/experimental/test_roxor.rb 2009-03-14 08:00:47 UTC (rev 919)
@@ -577,6 +577,28 @@
assert ":ok", "def foo(&block); :ok; end; p foo"
assert ":ok", "def foo(*args, &block); :ok; end; p foo"
assert ":ok", "def foo(x, *args, &block); x; end; p foo(:ok)"
+
+ assert "[1, nil, :c]", "def f(a, b = :b, c = :c) [a, b, c] end; p f(1, nil)"
+ assert "[1, :b, :c, 2]\n[1, 2, :c, 3]\n[1, 2, 3, 4]", %{
+ def f(a, b = :b, c = :c, d) [a, b, c, d] end
+ p f(1, 2)
+ p f(1, 2, 3)
+ p f(1, 2, 3, 4)
+ }
+ assert "[1, :b, :c, 2]\n[1, 2, :c, 3]\n[1, 2, 3, 4]", %{
+ def f(a, b = :b, c = :c, d) [a, b, c, d] end
+ p f(1, 2)
+ p f(1, 2, 3)
+ p f(1, 2, 3, 4)
+ }
+ assert "[1, :b, :c, [], 2, 3]\n[1, 2, :c, [], 3, 4]\n[1, 2, 3, [], 4, 5]\n[1, 2, 3, [4], 5, 6]\n[1, 2, 3, [4, 5], 6, 7]", %{
+ def f(a, b = :b, c = :c, *args, d, e) [a, b, c, args, d, e] end
+ p f(1, 2, 3)
+ p f(1, 2, 3, 4)
+ p f(1, 2, 3, 4, 5)
+ p f(1, 2, 3, 4, 5, 6)
+ p f(1, 2, 3, 4, 5, 6, 7)
+ }
end
test "blocks" do
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090314/408cc42c/attachment.html>
More information about the macruby-changes
mailing list