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

add a test for duck-type range.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2005-08-04 05:19:44 +00:00
parent 85eadbbf8c
commit b08e8d937f

View file

@ -14,4 +14,16 @@ class TestRange < Test::Unit::TestCase
r = (arr.shift)..(arr.shift) r = (arr.shift)..(arr.shift)
assert_equal(1..2, r, "[ruby-dev:26383]") assert_equal(1..2, r, "[ruby-dev:26383]")
end end
class DuckRange
def initialize(b,e)
@begin = b
@end = e
end
attr_reader :begin, :end
end
def test_duckrange
assert_equal("bc", "abcd"[DuckRange.new(1,2)])
end
end end