summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 dba4754..558a19b 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 2eb46ad..4b67c69 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 9d8db30..02dbb9b 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"))