summaryrefslogtreecommitdiff
path: root/spec/ruby/core/range/equal_value_spec.rb
blob: f88d3029bbb5ddb04910b72f36379ebd0c0f3356 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require_relative '../../spec_helper'
require_relative 'shared/equal_value'

describe "Range#==" do
  it_behaves_like :range_eql, :==

  it "returns true if the endpoints are ==" do
    (0..1).should == (0..1.0)
  end

  ruby_version_is "2.6" do
    it "returns true if the endpoints are == for endless ranges" do
      eval("(1.0..)").should == eval("(1.0..)")
    end
  end

  ruby_version_is "2.7" do
    it "returns true if the endpoints are == for beginless ranges" do
      eval("(...10)").should == eval("(...10)")
    end
  end
end