mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 22:14:37 +02:00
* 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:
parent
1e6a643fa9
commit
033e093363
3 changed files with 20 additions and 1 deletions
|
@ -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"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue