diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-11-27 19:42:30 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-11-27 19:42:30 +0000 |
commit | 4d177ae0d6d9f60c4000f45fb6f6df27317afbff (patch) | |
tree | 0902097443379e084d173f2a791acf3d56962cc5 /activesupport/test | |
parent | 69165404beb9286ca8953b1575b24c54107260ad (diff) | |
download | rails-4d177ae0d6d9f60c4000f45fb6f6df27317afbff.tar.gz rails-4d177ae0d6d9f60c4000f45fb6f6df27317afbff.tar.bz2 rails-4d177ae0d6d9f60c4000f45fb6f6df27317afbff.zip |
Added Array#from and Array#to that behaves just from String#from and String#to [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8224 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/array_ext_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index a5bae8c900..ade2e95c1b 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -1,6 +1,20 @@ require File.dirname(__FILE__) + '/../abstract_unit' require 'bigdecimal' +class ArrayExtAccessTests < Test::Unit::TestCase + def test_from + assert_equal %w( a b c d ), %w( a b c d ).from(0) + assert_equal %w( c d ), %w( a b c d ).from(2) + assert_nil %w( a b c d ).from(10) + end + + def test_to + assert_equal %w( a ), %w( a b c d ).to(0) + assert_equal %w( a b c ), %w( a b c d ).to(2) + assert_equal %w( a b c d ), %w( a b c d ).to(10) + end +end + class ArrayExtToParamTests < Test::Unit::TestCase def test_string_array assert_equal '', %w().to_param |