summaryrefslogtreecommitdiff
path: root/test/ruby/test_range.rb
blob: 455175087de421bb0579fa3d73bd9a214437a587 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require 'test/unit'

class TestRange < Test::Unit::TestCase
  def test_range_string
    # XXX: Is this really the test of Range?
    assert_equal([], ("a" ... "a").to_a)
    assert_equal(["a"], ("a" .. "a").to_a)
    assert_equal(["a"], ("a" ... "b").to_a)
    assert_equal(["a", "b"], ("a" .. "b").to_a)
  end

  def test_evaluation_order
    arr = [1,2]
    r = (arr.shift)..(arr.shift)
    assert_equal(1..2, r, "[ruby-dev:26383]")
  end
end