diff options
author | Koichi Sasada <[email protected]> | 2024-03-27 07:29:38 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2024-04-15 12:08:07 +0900 |
commit | 9180e33ca3a5886fec3f9e0a2f48072b55914e65 (patch) | |
tree | 6ce301e829b11f7189befef36a80924287d5d386 /test/ruby/test_optimization.rb | |
parent | 515e52a0b1ce61ccaffe9183bcb78dda95a64907 (diff) |
show warning for unused block
With verbopse mode (-w), the interpreter shows a warning if
a block is passed to a method which does not use the given block.
Warning on:
* the invoked method is written in C
* the invoked method is not `initialize`
* not invoked with `super`
* the first time on the call-site with the invoked method
(`obj.foo{}` will be warned once if `foo` is same method)
[Feature #15554]
`Primitive.attr! :use_block` is introduced to declare that primitive
functions (written in C) will use passed block.
For minitest, test needs some tweak, so use
https://github.com/minitest/minitest/commit/ea9caafc0754b1d6236a490d59e624b53209734a
for `test-bundled-gems`.
Diffstat (limited to 'test/ruby/test_optimization.rb')
-rw-r--r-- | test/ruby/test_optimization.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb index 70b6bde6ed..44ec615405 100644 --- a/test/ruby/test_optimization.rb +++ b/test/ruby/test_optimization.rb @@ -577,7 +577,7 @@ class TestRubyOptimization < Test::Unit::TestCase begin; class String undef freeze - def freeze + def freeze(&) block_given? end end |