summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-17 04:13:38 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-17 04:13:38 +0000
commit6d886eb2557fe846957da483ab08f7c964e95679 (patch)
tree9ac5968fc1c472288c59a77c27390509333819de /test
parent7e344b0b7b877fcf203ab29f56e417993fb4cb11 (diff)
merge revision(s) 47645: [Backport #10263]
* vm_eval.c (eval_string_with_cref): fix super from eval with scope. set klass in the current control frame to the class of the receiver in the context to be evaluated, this class/module must match the actual receiver to call super. [ruby-core:65122] [Bug #10263] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@47987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_super.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb
index 44fdf850fc..cb76236f9c 100644
--- a/test/ruby/test_super.rb
+++ b/test/ruby/test_super.rb
@@ -495,4 +495,19 @@ class TestSuper < Test::Unit::TestCase
end
assert_equal(%w[B A], result, bug9721)
end
+
+ def test_from_eval
+ bug10263 = '[ruby-core:65122] [Bug #10263a]'
+ a = Class.new do
+ def foo
+ "A"
+ end
+ end
+ b = Class.new(a) do
+ def foo
+ binding.eval("super")
+ end
+ end
+ assert_equal("A", b.new.foo, bug10263)
+ end
end