diff options
| author | Yusuke Endoh <mame@ruby-lang.org> | 2024-09-15 10:06:11 +0900 |
|---|---|---|
| committer | Yusuke Endoh <mame@ruby-lang.org> | 2024-09-15 10:06:11 +0900 |
| commit | 532af89e3b5b78dd3a6fe29c6cc64ad1b073afe2 (patch) | |
| tree | 6b18caa1ab8163b753d62a71477eb57bbc65ad22 /test/ruby | |
| parent | bc13ec735b33771c279e67e4143fa8e98a8252fd (diff) | |
Prevent warnings: the block passed to ... may be ignored
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_keyword.rb | 2 | ||||
| -rw-r--r-- | test/ruby/test_proc.rb | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index 4c6c35e6c3..a214acc232 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -193,7 +193,7 @@ class TestKeywordArguments < Test::Unit::TestCase # cfunc call assert_equal(nil, p(**nil)) - def self.a0; end + def self.a0(&); end assert_equal(nil, a0(**nil)) assert_equal(nil, :a0.to_proc.call(self, **nil)) assert_equal(nil, a0(**nil, &:block)) diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 192955c60a..dd05d09a49 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -217,11 +217,14 @@ class TestProc < Test::Unit::TestCase end def test_block_given_method_to_proc + verbose_bak, $VERBOSE = $VERBOSE, nil bug8341 = '[Bug #8341]' m = method(:m_block_given?).to_proc assert(!m.call, "#{bug8341} without block") assert(m.call {}, "#{bug8341} with block") assert(!m.call, "#{bug8341} without block second") + ensure + $VERBOSE = verbose_bak end def test_block_persist_between_calls |
