diff options
Diffstat (limited to 'spec/ruby/core/range/shared/cover.rb')
-rw-r--r-- | spec/ruby/core/range/shared/cover.rb | 96 |
1 files changed, 47 insertions, 49 deletions
diff --git a/spec/ruby/core/range/shared/cover.rb b/spec/ruby/core/range/shared/cover.rb index e04682ba71..f3c7d22668 100644 --- a/spec/ruby/core/range/shared/cover.rb +++ b/spec/ruby/core/range/shared/cover.rb @@ -93,63 +93,61 @@ describe :range_cover, shared: true do end describe :range_cover_subrange, shared: true do - ruby_version_is "2.6" do - context "range argument" do - it "accepts range argument" do - (0..10).send(@method, (3..7)).should be_true - (0..10).send(@method, (3..15)).should be_false - (0..10).send(@method, (-2..7)).should be_false - - (1.1..7.9).send(@method, (2.5..6.5)).should be_true - (1.1..7.9).send(@method, (2.5..8.5)).should be_false - (1.1..7.9).send(@method, (0.5..6.5)).should be_false - - ('c'..'i').send(@method, ('d'..'f')).should be_true - ('c'..'i').send(@method, ('d'..'z')).should be_false - ('c'..'i').send(@method, ('a'..'f')).should be_false - - range_10_100 = RangeSpecs::TenfoldSucc.new(10)..RangeSpecs::TenfoldSucc.new(100) - range_20_90 = RangeSpecs::TenfoldSucc.new(20)..RangeSpecs::TenfoldSucc.new(90) - range_20_110 = RangeSpecs::TenfoldSucc.new(20)..RangeSpecs::TenfoldSucc.new(110) - range_0_90 = RangeSpecs::TenfoldSucc.new(0)..RangeSpecs::TenfoldSucc.new(90) - - range_10_100.send(@method, range_20_90).should be_true - range_10_100.send(@method, range_20_110).should be_false - range_10_100.send(@method, range_0_90).should be_false - end + context "range argument" do + it "accepts range argument" do + (0..10).send(@method, (3..7)).should be_true + (0..10).send(@method, (3..15)).should be_false + (0..10).send(@method, (-2..7)).should be_false + + (1.1..7.9).send(@method, (2.5..6.5)).should be_true + (1.1..7.9).send(@method, (2.5..8.5)).should be_false + (1.1..7.9).send(@method, (0.5..6.5)).should be_false + + ('c'..'i').send(@method, ('d'..'f')).should be_true + ('c'..'i').send(@method, ('d'..'z')).should be_false + ('c'..'i').send(@method, ('a'..'f')).should be_false + + range_10_100 = RangeSpecs::TenfoldSucc.new(10)..RangeSpecs::TenfoldSucc.new(100) + range_20_90 = RangeSpecs::TenfoldSucc.new(20)..RangeSpecs::TenfoldSucc.new(90) + range_20_110 = RangeSpecs::TenfoldSucc.new(20)..RangeSpecs::TenfoldSucc.new(110) + range_0_90 = RangeSpecs::TenfoldSucc.new(0)..RangeSpecs::TenfoldSucc.new(90) + + range_10_100.send(@method, range_20_90).should be_true + range_10_100.send(@method, range_20_110).should be_false + range_10_100.send(@method, range_0_90).should be_false + end - it "supports boundaries of different comparable types" do - (0..10).send(@method, (3.1..7.9)).should be_true - (0..10).send(@method, (3.1..15.9)).should be_false - (0..10).send(@method, (-2.1..7.9)).should be_false - end + it "supports boundaries of different comparable types" do + (0..10).send(@method, (3.1..7.9)).should be_true + (0..10).send(@method, (3.1..15.9)).should be_false + (0..10).send(@method, (-2.1..7.9)).should be_false + end - it "returns false if types are not comparable" do - (0..10).send(@method, ('a'..'z')).should be_false - (0..10).send(@method, (RangeSpecs::TenfoldSucc.new(0)..RangeSpecs::TenfoldSucc.new(100))).should be_false - end + it "returns false if types are not comparable" do + (0..10).send(@method, ('a'..'z')).should be_false + (0..10).send(@method, (RangeSpecs::TenfoldSucc.new(0)..RangeSpecs::TenfoldSucc.new(100))).should be_false + end - it "honors exclusion of right boundary (:exclude_end option)" do - # Integer - (0..10).send(@method, (0..10)).should be_true - (0...10).send(@method, (0...10)).should be_true + it "honors exclusion of right boundary (:exclude_end option)" do + # Integer + (0..10).send(@method, (0..10)).should be_true + (0...10).send(@method, (0...10)).should be_true - (0..10).send(@method, (0...10)).should be_true - (0...10).send(@method, (0..10)).should be_false + (0..10).send(@method, (0...10)).should be_true + (0...10).send(@method, (0..10)).should be_false - (0...11).send(@method, (0..10)).should be_true - (0..10).send(@method, (0...11)).should be_true + (0...11).send(@method, (0..10)).should be_true + (0..10).send(@method, (0...11)).should be_true - # Float - (0..10.1).send(@method, (0..10.1)).should be_true - (0...10.1).send(@method, (0...10.1)).should be_true + # Float + (0..10.1).send(@method, (0..10.1)).should be_true + (0...10.1).send(@method, (0...10.1)).should be_true - (0..10.1).send(@method, (0...10.1)).should be_true - (0...10.1).send(@method, (0..10.1)).should be_false + (0..10.1).send(@method, (0...10.1)).should be_true + (0...10.1).send(@method, (0..10.1)).should be_false - (0...11.1).send(@method, (0..10.1)).should be_true - (0..10.1).send(@method, (0...11.1)).should be_false - end + (0...11.1).send(@method, (0..10.1)).should be_true + (0..10.1).send(@method, (0...11.1)).should be_false end end |