From a708c7d3995f04f9ae41ee4526f48a440ae3058e Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 4 Aug 2015 06:35:31 +0000 Subject: * 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 --- test/ruby/test_eval.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index 9d8db3017b..02dbb9b379 100644 --- a/test/ruby/test_eval.rb +++ b/test/ruby/test_eval.rb @@ -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")) -- cgit v1.2.3