* string.c (rb_str_upto): generate numerical sequence when

characters in both edges are all digits.  [ruby-talk:343186]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2009-08-16 22:43:48 +00:00
parent 9166dd9ec7
commit b21088b431
3 changed files with 56 additions and 3 deletions

View file

@ -9,6 +9,12 @@ class TestRange < Test::Unit::TestCase
assert_equal(["a", "b"], ("a" .. "b").to_a)
end
def test_range_numeric_string
assert_equal(["6", "7", "8"], ("6".."8").to_a, "[ruby-talk:343187]")
assert_equal(["6", "7"], ("6"..."8").to_a)
assert_equal(["9", "10"], ("9".."10").to_a)
end
def test_evaluation_order
arr = [1,2]
r = (arr.shift)..(arr.shift)