aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_enumerator.rb
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-06 17:15:15 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-06 17:15:15 +0000
commitc2dc0dc1ce7ae4340966118994e04d4dd3fb0c3f (patch)
treeff731793b5d71c55c493e9780c24843752abeb12 /test/ruby/test_enumerator.rb
parentfaed90d814d6739cc55e6f0103fdc06fc1c5de0a (diff)
downloadruby-c2dc0dc1ce7ae4340966118994e04d4dd3fb0c3f.tar.gz
* numeric.c (int_upto, int_downto): Support for Integer#{down|up}to.size
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_enumerator.rb')
-rw-r--r--test/ruby/test_enumerator.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_enumerator.rb b/test/ruby/test_enumerator.rb
index 3ce471bb24..fe00aa7e57 100644
--- a/test/ruby/test_enumerator.rb
+++ b/test/ruby/test_enumerator.rb
@@ -543,5 +543,11 @@ class TestEnumerator < Test::Unit::TestCase
assert_equal Float::INFINITY, (42..Float::INFINITY).step(2).size
assert_raise(ArgumentError){ (1..10).step(-2).size }
end
+
+ def test_size_for_downup_to
+ assert_equal 0, 1.upto(-100).size
+ assert_equal 102, 1.downto(-100).size
+ assert_equal Float::INFINITY, 42.upto(Float::INFINITY).size
+ end
end