Skip to content

Commit

Permalink
Fix warnings in Regexp#{match,match?} specs
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Nov 3, 2019
1 parent fbacfe6 commit 782d1b8
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions spec/ruby/core/regexp/match_spec.rb
Expand Up @@ -89,12 +89,14 @@

ruby_version_is ""..."3.0" do
it "resets $~ if passed nil" do
# set $~
/./.match("a")
$~.should be_kind_of(MatchData)
suppress_warning do
# set $~
/./.match("a")
$~.should be_kind_of(MatchData)

/1/.match(nil)
$~.should be_nil
/1/.match(nil)
$~.should be_nil
end
end
end

Expand Down Expand Up @@ -145,7 +147,9 @@

ruby_version_is ""..."3.0" do
it "returns false when given nil" do
/./.match?(nil).should be_false
suppress_warning do
/./.match?(nil).should be_false
end
end
end

Expand Down

0 comments on commit 782d1b8

Please sign in to comment.