diff options
author | headius <headius@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-02 18:22:15 +0000 |
---|---|---|
committer | headius <headius@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-02 18:22:15 +0000 |
commit | 0b31b7cd14c6d1d174d993ba80fd242160fd2bd2 (patch) | |
tree | 4914d06b17d41e620256154114cf9c55a2762506 /test/ruby | |
parent | f9dcfb2bca3d32099c6afab065c5476e234e6dfd (diff) | |
download | ruby-0b31b7cd14c6d1d174d993ba80fd242160fd2bd2.tar.gz |
* 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
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_eval.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index 1ad186f869..9d8db3017b 100644 --- a/test/ruby/test_eval.rb +++ b/test/ruby/test_eval.rb @@ -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")) |