summaryrefslogtreecommitdiff
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
commit033e093363b53024aa0f40599fc48d78418a61a9 (patch)
treec80d27706229e677f8ce2560bf43177f18b2dd91
parent1e6a643fa9e5e5945cf6bd2ef61868b9cb7f85bf (diff)
* 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
-rw-r--r--ChangeLog9
-rw-r--r--proc.c2
-rw-r--r--test/ruby/test_eval.rb10
3 files changed, 20 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index dba4754514..558a19b9cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Tue Aug 04 15:30:04 2015 Koichi Sasada <ko1@atdot.net>
+
+ * 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
+
Tue Aug 4 12:12:14 2015 Eric Wong <e@80x24.org>
* variable.c: wrap long lines
diff --git a/proc.c b/proc.c
index 2eb46ad5d2..4b67c69755 100644
--- a/proc.c
+++ b/proc.c
@@ -670,7 +670,7 @@ rb_block_clear_env_self(VALUE proc)
rb_env_t *env;
GetProcPtr(proc, po);
GetEnvPtr(rb_vm_proc_envval(po), env);
- env->env[0] = Qnil;
+ env->env[0] = Qfalse;
return proc;
}
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"))