* proc.c (rb_block_clear_env_self): clear by Qfalse intead of Qnil.

[Bug #11409]
* test/ruby/test_eval.rb: add tests for this issue,
  written by @0x0dea.
  https://github.com/ruby/ruby/pull/988



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2015-08-04 06:35:31 +00:00
parent 1e6a643fa9
commit 033e093363
3 changed files with 20 additions and 1 deletions

View file

@ -126,6 +126,10 @@ class TestEval < Test::Unit::TestCase
}
end
def test_module_eval_block_symbol
assert_equal "Math", Math.module_eval(&:to_s)
end
def forall_TYPE
objects = [Object.new, [], nil, true, false] # TODO: check
objects.each do |obj|
@ -199,6 +203,12 @@ class TestEval < Test::Unit::TestCase
assert_equal self, pr.call
end
def test_instance_eval_block_symbol
forall_TYPE do |o|
assert_equal o.to_s, o.instance_eval(&:to_s)
end
end
def test_instance_eval_cvar
[Object.new, [], 7, :sym, true, false, nil].each do |obj|
assert_equal(13, obj.instance_eval("@@cvar"))