aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_eval.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-04 06:35:31 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-04 06:35:31 +0000
commita708c7d3995f04f9ae41ee4526f48a440ae3058e (patch)
treec80d27706229e677f8ce2560bf43177f18b2dd91 /test/ruby/test_eval.rb
parentc91de970d4c3e87f30c028b016e2de6c0526959a (diff)
downloadruby-a708c7d3995f04f9ae41ee4526f48a440ae3058e.tar.gz
* 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
Diffstat (limited to 'test/ruby/test_eval.rb')
-rw-r--r--test/ruby/test_eval.rb10
1 files changed, 10 insertions, 0 deletions
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"))