mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
range.c: === by cover?
* range.c (range_eqq): switch `Range#===` to use `cover?` instead of `include?`. [Feature #14575] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d50ecb63ec
commit
989e07c0f2
4 changed files with 41 additions and 7 deletions
|
@ -3,9 +3,18 @@ require_relative 'shared/cover_and_include'
|
|||
require_relative 'shared/cover'
|
||||
|
||||
describe "Range#===" do
|
||||
it "returns the result of calling #include? on self" do
|
||||
range = 0...10
|
||||
range.should_receive(:include?).with(2).and_return(:true)
|
||||
(range === 2).should == :true
|
||||
ruby_version_is ""..."2.6" do
|
||||
it "returns the result of calling #include? on self" do
|
||||
range = 0...10
|
||||
range.should_receive(:include?).with(2).and_return(:true)
|
||||
(range === 2).should == :true
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "2.6" do
|
||||
it "returns the result of calling #cover? on self" do
|
||||
range = RangeSpecs::Custom.new(0)..RangeSpecs::Custom.new(10)
|
||||
(range === RangeSpecs::Custom.new(2)).should == true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue