summaryrefslogtreecommitdiffstats
path: root/bootstraptest/test_method.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-24 08:40:45 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-24 08:40:45 +0000
commit5ba0ecca472eeae12ed2b2c179f47b015831aaa5 (patch)
tree8c50f9cef922a9fce4f7cc68adce20599b1df35d /bootstraptest/test_method.rb
parent0bd4b17f8bd6682a779ecebb64d2adc9eb27cd2d (diff)
downloadruby-5ba0ecca472eeae12ed2b2c179f47b015831aaa5.tar.gz
ruby-5ba0ecca472eeae12ed2b2c179f47b015831aaa5.tar.xz
ruby-5ba0ecca472eeae12ed2b2c179f47b015831aaa5.zip
* insnhelper.h: change CHECK_STACK_OVERFLOW() to throw exception.
* vm.c (caller_setup_arg), vm_macro.def: remove macro_eval_setup_send_arguments and add caller_setup_arg(). * insns.def: ditto. * bootstraptest/test_method.rb: add splat arg tests. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bootstraptest/test_method.rb')
-rw-r--r--bootstraptest/test_method.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb
index 342803e21..faf3d4bc5 100644
--- a/bootstraptest/test_method.rb
+++ b/bootstraptest/test_method.rb
@@ -318,6 +318,33 @@ assert_equal '1', %q( class C; def m() 7 end; private :m end
assert_equal '1', %q( class C; def m() 1 end; private :m end
C.new.funcall(:m) )
+# splat and block arguments
+assert_equal %q{[[[:x, :y, :z], NilClass], [[1, :x, :y, :z], NilClass], [[1, 2, :x, :y, :z], NilClass], [[:obj], NilClass], [[1, :obj], NilClass], [[1, 2, :obj], NilClass], [[], Proc], [[1], Proc], [[1, 2], Proc], [[], Proc], [[1], Proc], [[1, 2], Proc], [[:x, :y, :z], Proc], [[1, :x, :y, :z], Proc], [[1, 2, :x, :y, :z], Proc]]}, %q{
+def m(*args, &b)
+ $result << [args, b.class]
+end
+$result = []
+ary = [:x, :y, :z]
+obj = :obj
+b = Proc.new{}
+
+m(*ary)
+m(1,*ary)
+m(1,2,*ary)
+m(*obj)
+m(1,*obj)
+m(1,2,*obj)
+m(){}
+m(1){}
+m(1,2){}
+m(&b)
+m(1,&b)
+m(1,2,&b)
+m(*ary,&b)
+m(1,*ary,&b)
+m(1,2,*ary,&b)
+$result
+}
# post test
assert_equal %q{[1, 2, :o1, :o2, [], 3, 4, NilClass, nil, nil]}, %q{