1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/ruby/test_yield.rb (TestYieldGen): relax array size check

in nested parameters.
  [ruby-dev:31485]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2007-08-18 10:04:24 +00:00
parent 0dec7d5788
commit 7017b63b81
2 changed files with 13 additions and 7 deletions

View file

@ -1,3 +1,9 @@
Sat Aug 18 19:02:34 2007 Tanaka Akira <akr@fsij.org>
* test/ruby/test_yield.rb (TestYieldGen): relax array size check
in nested parameters.
[ruby-dev:31485]
Sat Aug 18 17:44:42 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/tk/tcltklib.c (Init_tcltklib): use rb_set_end_proc().

View file

@ -193,13 +193,13 @@ class TestRubyYieldGen < Test::Unit::TestCase
eval code
end
def emu_bind_single(arg, param, islambda, result_binding)
def emu_bind_single(arg, param, result_binding)
#p [:emu_bind_single, arg, param]
if param.length == 1 && String === param[0] && /\A[a-z0-9]+\z/ =~ param[0]
result_binding[param[0]] = arg
elsif param.length == 1 && Array === param[0] && param[0][0] == '(' && param[0][-1] == ')'
arg = [arg] unless Array === arg
emu_bind_params(arg, split_by_comma(param[0][1...-1]), islambda, result_binding)
emu_bind_params(arg, split_by_comma(param[0][1...-1]), false, result_binding)
else
raise "unexpected param: #{param.inspect}"
end
@ -234,18 +234,18 @@ class TestRubyYieldGen < Test::Unit::TestCase
pre_params = params[0...star_index]
rest_param = params[star_index]
post_params = params[(star_index+1)..-1]
pre_params.each {|par| emu_bind_single(args.shift, par, islambda, result_binding) }
pre_params.each {|par| emu_bind_single(args.shift, par, result_binding) }
if post_params.length <= args.length
post_params.reverse_each {|par| emu_bind_single(args.pop, par, islambda, result_binding) }
post_params.reverse_each {|par| emu_bind_single(args.pop, par, result_binding) }
else
post_params.each {|par| emu_bind_single(args.shift, par, islambda, result_binding) }
post_params.each {|par| emu_bind_single(args.shift, par, result_binding) }
end
if rest_param != ['*']
emu_bind_single(args, rest_param[1..-1], islambda, result_binding)
emu_bind_single(args, rest_param[1..-1], result_binding)
end
else
params.each_with_index {|par, i|
emu_bind_single(args[i], par, islambda, result_binding)
emu_bind_single(args[i], par, result_binding)
}
end