diff options
Diffstat (limited to 'spec/ruby/core/nil/match_spec.rb')
| -rw-r--r-- | spec/ruby/core/nil/match_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/ruby/core/nil/match_spec.rb b/spec/ruby/core/nil/match_spec.rb new file mode 100644 index 0000000000..27ebc53c3d --- /dev/null +++ b/spec/ruby/core/nil/match_spec.rb @@ -0,0 +1,21 @@ +require_relative '../../spec_helper' + +describe "NilClass#=~" do + it "returns nil matching any object" do + o = nil + + suppress_warning do + (o =~ /Object/).should == nil + (o =~ 'Object').should == nil + (o =~ Object).should == nil + (o =~ Object.new).should == nil + (o =~ nil).should == nil + (o =~ false).should == nil + (o =~ true).should == nil + end + end + + it "should not warn" do + -> { nil =~ /a/ }.should_not complain(verbose: true) + end +end |
