From 0ada813abfe3a049da29bd423ba34606a00777bd Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 25 Aug 2007 03:03:29 +0000 Subject: [PATCH] test assignment order. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_assignment.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/ruby/test_assignment.rb b/test/ruby/test_assignment.rb index e6fad1d165..b355e444cf 100644 --- a/test/ruby/test_assignment.rb +++ b/test/ruby/test_assignment.rb @@ -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