зеркало из https://github.com/github/ruby.git
* 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:
Родитель
1e6a643fa9
Коммит
033e093363
|
@ -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
|
||||
|
|
2
proc.c
2
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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"))
|
||||
|
|
Загрузка…
Ссылка в новой задаче