summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorheadius <headius@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-02 18:22:15 +0000
committerheadius <headius@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-02 18:22:15 +0000
commit0b31b7cd14c6d1d174d993ba80fd242160fd2bd2 (patch)
tree4914d06b17d41e620256154114cf9c55a2762506 /test
parentf9dcfb2bca3d32099c6afab065c5476e234e6dfd (diff)
* 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')
-rw-r--r--test/ruby/test_eval.rb9
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"))