diff options
author | Benoit Daloze <eregontp@gmail.com> | 2024-02-26 14:45:30 +0100 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2024-02-26 14:45:30 +0100 |
commit | 815db5c0289f5bbea2af275933ba6a4bf60a6967 (patch) | |
tree | db319dbcc035e4248ee25c47916c6e0c1171164b /spec/ruby/core/kernel/not_match_spec.rb | |
parent | 40c9a3dad5bc18213eb9b5ad21aa00580c12c77b (diff) |
Update to ruby/spec@3a510bb
Diffstat (limited to 'spec/ruby/core/kernel/not_match_spec.rb')
-rw-r--r-- | spec/ruby/core/kernel/not_match_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/ruby/core/kernel/not_match_spec.rb b/spec/ruby/core/kernel/not_match_spec.rb index 906f18df2c..f8dd82fad8 100644 --- a/spec/ruby/core/kernel/not_match_spec.rb +++ b/spec/ruby/core/kernel/not_match_spec.rb @@ -14,6 +14,20 @@ describe "Kernel#!~" do (obj !~ :foo).should == false end + ruby_version_is ""..."3.2" do + it "returns true if self does not respond to #=~" do + suppress_warning do + (Object.new !~ :foo).should == true + end + end + end + + ruby_version_is "3.2" do + it "raises NoMethodError if self does not respond to #=~" do + -> { Object.new !~ :foo }.should raise_error(NoMethodError) + end + end + it 'can be overridden in subclasses' do obj = KernelSpecs::NotMatch.new (obj !~ :bar).should == :foo |