summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-19 22:55:59 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-19 22:55:59 +0000
commitfee7d48517cbf14b6ddc35ee584393fa9e6d90cd (patch)
tree6051ce6a6e6cb978e3fd74b5a27fb98c5bf943d8 /test
parent0df55df4964145c45d03636e63e292e17a7eb433 (diff)
vm_eval.c: fix super from eval with scope
* 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/trunk@47645 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 bea490d0cd..820e22134a 100644
--- a/test/ruby/test_super.rb
+++ b/test/ruby/test_super.rb
@@ -493,4 +493,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