summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-02 07:52:01 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-02 07:52:01 +0000
commit3330ec6cffd7fc128e23b6021689e6a58851bfd0 (patch)
treed24f4ab3bce37ba49274cbed7f3083d3ebffd6ab /test
parent7f31465bb51a54b55985e7bbe7b20d70b3e06aae (diff)
add tests for [ruby-dev:34557] and [ruby-dev:34558].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_range.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb
index 09781dd407..81be101857 100644
--- a/test/ruby/test_range.rb
+++ b/test/ruby/test_range.rb
@@ -147,6 +147,20 @@ class TestRange < Test::Unit::TestCase
a = []
(o1...o2).step(1) {|x| a << x }
assert_equal([o1], a)
+
+ assert_nothing_raised("[ruby-dev:34557]") { (0..2).step(0.5) {|x| } }
+
+ a = []
+ (0..2).step(0.5) {|x| a << x }
+ assert_equal([0, 0.5, 1.0, 1.5, 2.0], a)
+
+ a = []
+ (0x40000000..0x40000002).step(0.5) {|x| a << x }
+ assert_equal([1073741824, 1073741824.5, 1073741825.0, 1073741825.5, 1073741826], a)
+
+ o = Object.new
+ def o.to_int() 1 end
+ assert_nothing_raised("[ruby-dev:34558]") { (0..2).step(o) {|x| } }
end
def test_each