mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_eval.rb: add case to test "sticky" instance_eval
self when passed a reified block (proc/lambda). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f9dcfb2bca
commit
0b31b7cd14
1 changed files with 9 additions and 0 deletions
|
@ -190,6 +190,15 @@ class TestEval < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_instance_eval_block_self
|
||||
# instance_eval(&block)'s self must not be sticky (jruby/jruby#2060)
|
||||
pr = proc { self }
|
||||
assert_equal self, pr.call
|
||||
o = Object.new
|
||||
assert_equal o, o.instance_eval(&pr)
|
||||
assert_equal self, pr.call
|
||||
end
|
||||
|
||||
def test_instance_eval_cvar
|
||||
[Object.new, [], 7, :sym, true, false, nil].each do |obj|
|
||||
assert_equal(13, obj.instance_eval("@@cvar"))
|
||||
|
|
Loading…
Reference in a new issue