Skip to content

Commit

Permalink
Prevent warnings: the block passed to ... may be ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
mame committed Sep 15, 2024
1 parent bc13ec7 commit 532af89
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/ruby/test_keyword.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def test_keyword_splat_nil
# 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))
Expand Down
3 changes: 3 additions & 0 deletions test/ruby/test_proc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,14 @@ def test_block_given_method
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
Expand Down

0 comments on commit 532af89

Please sign in to comment.