mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test assignment order.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
977d66ec99
commit
0ada813abf
1 changed files with 11 additions and 2 deletions
|
@ -650,12 +650,21 @@ class TestAssignmentGen < Test::Unit::TestCase
|
|||
|
||||
def do_assign(assign, vars)
|
||||
assign = assign.to_s
|
||||
code = "#{assign}; [#{vars.join(",")}]"
|
||||
code1 = "#{assign}; [#{vars.join(",")}]"
|
||||
assign.gsub!(/\bv\d+\b/, "o.a")
|
||||
code2 = "o=[];class << o; self end.send!(:define_method,:a=){|v|self << v};#{assign};o"
|
||||
begin
|
||||
vals = eval(code)
|
||||
vals1 = eval(code1)
|
||||
rescue Exception
|
||||
return {:ex=>$!.message}
|
||||
end
|
||||
begin
|
||||
vals2 = eval(code2)
|
||||
rescue Exception
|
||||
return {:ex=>$!.message}
|
||||
end
|
||||
assert_equal(vals1, vals2, code1)
|
||||
vals = vals1
|
||||
h = {}
|
||||
[vars, vals].transpose.each {|k,v| h[k] = v }
|
||||
h
|
||||
|
|
Loading…
Reference in a new issue