1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* range.c (range_step): treat symbols specially so that iterating

over symbols should work like strings.  [ruby-core:24780]

* range.c (range_each): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2009-08-17 17:00:47 +00:00
parent 0ff29a4fc1
commit 95e77269a9
3 changed files with 52 additions and 0 deletions

View file

@ -18,6 +18,10 @@ class TestRange < Test::Unit::TestCase
assert_equal(["9", "10"], ("9"..SimpleDelegator.new("10")).to_a)
end
def test_range_symbol
assert_equal([:a, :b], (:a .. :b).to_a)
end
def test_evaluation_order
arr = [1,2]
r = (arr.shift)..(arr.shift)