diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-08-04 05:19:44 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-08-04 05:19:44 +0000 |
commit | b08e8d937f0b4f4289dd204e9c08b8a45e469baf (patch) | |
tree | cc3b2efc5c73175e811f64b3f5d73e7099466ba4 | |
parent | 85eadbbf8cc0bf6e366c34b4db939501f406907d (diff) | |
download | ruby-b08e8d937f0b4f4289dd204e9c08b8a45e469baf.tar.gz |
add a test for duck-type range.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/ruby/test_range.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb index 455175087d..1d25e7c311 100644 --- a/test/ruby/test_range.rb +++ b/test/ruby/test_range.rb @@ -14,4 +14,16 @@ class TestRange < Test::Unit::TestCase r = (arr.shift)..(arr.shift) assert_equal(1..2, r, "[ruby-dev:26383]") 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 |