Skip to content

Commit

Permalink
Fix :ambiguous_slash warning handling on Ruby 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyevans committed Feb 13, 2021
1 parent 6a3c52e commit 171e107
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
=== master

* Fix :ambiguous_slash warning handling on Ruby 3.0 (jeremyevans)

=== 1.1.0 (2020-06-12)

* Allow Warning.process to be called with a hash of actions instead of a block (jeremyevans)
Expand Down
2 changes: 1 addition & 1 deletion lib/warning.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Warning
module Processor
# Map of symbols to regexps for warning messages to ignore.
IGNORE_MAP = {
ambiguous_slash: /: warning: ambiguous first argument; put parentheses or a space even after `\/' operator\n\z/,
ambiguous_slash: /: warning: ambiguous first argument; put parentheses or a space even after `\/' operator\n\z|: warning: ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after `\/' operator\n\z/,
arg_prefix: /: warning: `[&\*]' interpreted as argument prefix\n\z/,
bignum: /: warning: constant ::Bignum is deprecated\n\z/,
fixnum: /: warning: constant ::Fixnum is deprecated\n\z/,
Expand Down
2 changes: 1 addition & 1 deletion test/test_warning.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def test_warning_ignore_bignum

def test_warning_ignore_ambiguous_slash
def self.d(re); end
assert_warning(/warning: ambiguous first argument; put parentheses or a space even after `\/' operator/) do
assert_warning(/warning: ambi/) do
instance_eval('d /a/', __FILE__)
end

Expand Down

0 comments on commit 171e107

Please sign in to comment.