From 5ba0ecca472eeae12ed2b2c179f47b015831aaa5 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 24 Jun 2007 08:40:45 +0000 Subject: * 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 --- bootstraptest/test_method.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'bootstraptest') 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{ -- cgit