aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/enumerable_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-08-09 13:22:06 +0200
committerPratik Naik <pratiknaik@gmail.com>2009-08-09 15:56:10 +0100
commit1bd4d1c67459a91415ee73a8f55d2309c0d62a87 (patch)
tree4862a97d1187ee76c64df4083792af0bfcd1a363 /activesupport/test/core_ext/enumerable_test.rb
parentd811864e880580549bc1ab73a1ab0be886598e6e (diff)
downloadrails-1bd4d1c67459a91415ee73a8f55d2309c0d62a87.tar.gz
rails-1bd4d1c67459a91415ee73a8f55d2309c0d62a87.tar.bz2
rails-1bd4d1c67459a91415ee73a8f55d2309c0d62a87.zip
Optimize Range#sum to use arithmetic progression when a block is not given [#2489].
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activesupport/test/core_ext/enumerable_test.rb')
-rw-r--r--activesupport/test/core_ext/enumerable_test.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb
index 1927a0ad0d..6512754e53 100644
--- a/activesupport/test/core_ext/enumerable_test.rb
+++ b/activesupport/test/core_ext/enumerable_test.rb
@@ -61,7 +61,9 @@ class EnumerableTests < Test::Unit::TestCase
end
def test_enumerable_sums
+ assert_equal 20, (1..4).sum { |i| i * 2 }
assert_equal 10, (1..4).sum
+ assert_equal 6, (1...4).sum
end
def test_each_with_object