diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-26 03:10:02 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-26 03:10:02 +0000 |
commit | c9d720b873f570c734b136eb639f0be117803f5c (patch) | |
tree | 69da424273fcdac1321588b0d0cba395175f9e84 /test/lib | |
parent | b171d9204637e3790fce7bfb32fe9a54014d8301 (diff) |
parse.y: remove "shadowing outer local variable" warning
You can now write the following without warning.
user = User.all.find {|user| cond(user) }
Fixes [Feature #12490].
A patch from Soutaro Matsumoto <[email protected]>.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/lib')
-rw-r--r-- | test/lib/test/unit/assertions.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/lib/test/unit/assertions.rb b/test/lib/test/unit/assertions.rb index 789e2d6c3d..dfa929a136 100644 --- a/test/lib/test/unit/assertions.rb +++ b/test/lib/test/unit/assertions.rb @@ -693,6 +693,16 @@ eom assert_warning(*args) {$VERBOSE = false; yield} end + def assert_no_warning(pat, msg = nil) + stderr = EnvUtil.verbose_warning { + EnvUtil.with_default_internal(pat.encoding) { + yield + } + } + msg = message(msg) {diff pat, stderr} + refute(pat === stderr, msg) + end + def assert_no_memory_leak(args, prepare, code, message=nil, limit: 2.0, rss: false, **opt) # TODO: consider choosing some appropriate limit for MJIT and stop skipping this once it does not randomly fail skip 'assert_no_memory_leak may consider MJIT memory usage as leak' if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? |