diff options
author | Kenichi Kamiya <kachick1@gmail.com> | 2019-11-02 00:54:36 +0900 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-11-03 11:03:04 +0100 |
commit | 452bee3ee8d68059fabd9b1c7a75661b14e3933e (patch) | |
tree | d0d6abd12e989242a1e70d2864682f39b7efde45 /spec | |
parent | 772b0613c583773cd2eda23bce8275926a351e79 (diff) | |
download | bundler-452bee3ee8d68059fabd9b1c7a75661b14e3933e.tar.gz |
Revert nil error and adding deprecation message
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ruby/core/regexp/match_spec.rb | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/spec/ruby/core/regexp/match_spec.rb b/spec/ruby/core/regexp/match_spec.rb index c117dcac69..8297be1c1d 100644 --- a/spec/ruby/core/regexp/match_spec.rb +++ b/spec/ruby/core/regexp/match_spec.rb @@ -87,7 +87,7 @@ describe "Regexp#match" do end end - ruby_version_is ""..."2.7" do + ruby_version_is ""..."3.0" do it "resets $~ if passed nil" do # set $~ /./.match("a") @@ -98,7 +98,13 @@ describe "Regexp#match" do end end - ruby_version_is "2.7" do + ruby_version_is "2.7"..."3.0" do + it "warns the deprecation when the given argument is nil" do + -> { /foo/.match(nil) }.should complain(/given argument is nil/) + end + end + + ruby_version_is "3.0" do it "raises TypeError when the given argument is nil" do -> { /foo/.match(nil) }.should raise_error(TypeError) end @@ -137,13 +143,19 @@ describe "Regexp#match?" do /str/i.match?('string', 1).should be_false end - ruby_version_is ""..."2.7" do + ruby_version_is ""..."3.0" do it "returns false when given nil" do /./.match?(nil).should be_false end end - ruby_version_is "2.7" do + ruby_version_is "2.7"..."3.0" do + it "warns the deprecation" do + -> { /./.match?(nil) }.should complain(/given argument is nil/) + end + end + + ruby_version_is "3.0" do it "raises TypeError when given nil" do -> { /./.match?(nil) }.should raise_error(TypeError) end |