summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-25 03:03:29 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-25 03:03:29 +0000
commit0ada813abfe3a049da29bd423ba34606a00777bd (patch)
tree6fcefb85c9169c0db51e36b93c5d8a186f9f57b6
parent977d66ec993b0f1892fb3e4cd8ac1c41716daf85 (diff)
test assignment order.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/ruby/test_assignment.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/ruby/test_assignment.rb b/test/ruby/test_assignment.rb
index e6fad1d..b355e44 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