2018-03-04 10:09:32 -05:00
|
|
|
require_relative '../../spec_helper'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
|
|
|
describe "Kernel#=~" do
|
|
|
|
it "returns nil matching any object" do
|
|
|
|
o = Object.new
|
|
|
|
|
2018-12-28 19:22:52 -05:00
|
|
|
suppress_warning do
|
|
|
|
(o =~ /Object/).should be_nil
|
|
|
|
(o =~ 'Object').should be_nil
|
|
|
|
(o =~ Object).should be_nil
|
|
|
|
(o =~ Object.new).should be_nil
|
|
|
|
(o =~ nil).should be_nil
|
|
|
|
(o =~ true).should be_nil
|
|
|
|
end
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
2019-01-20 15:38:57 -05:00
|
|
|
|
|
|
|
ruby_version_is "2.6" do
|
|
|
|
it "is deprecated" do
|
|
|
|
-> do
|
|
|
|
Object.new =~ /regexp/
|
|
|
|
end.should complain(/deprecated Object#=~ is called on Object/, verbose: true)
|
|
|
|
end
|
|
|
|
end
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|