diff options
author | Scott Barron <scott@elitists.net> | 2006-02-08 00:49:41 +0000 |
---|---|---|
committer | Scott Barron <scott@elitists.net> | 2006-02-08 00:49:41 +0000 |
commit | 2d7309388d2e8236a260a191ffebc02a4add5931 (patch) | |
tree | daf3603b3f0671bb2fa10a63afcae72a5f390cce /activesupport/test/core_ext | |
parent | 49fad6e6d5171e632086d7f7491ef14c8a04e4cc (diff) | |
download | rails-2d7309388d2e8236a260a191ffebc02a4add5931.tar.gz rails-2d7309388d2e8236a260a191ffebc02a4add5931.tar.bz2 rails-2d7309388d2e8236a260a191ffebc02a4add5931.zip |
Make String#last behave more like Array#last, i.e.
"f".last(3) => "f" not
"f".last(3) => nil
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3548 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/string_ext_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 92f57beb5f..e09eb02188 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -77,6 +77,12 @@ class StringInflectionsTest < Test::Unit::TestCase assert_equal "o", s.last assert_equal "llo", s.last(3) + + assert_equal 'x', 'x'.first + assert_equal 'x', 'x'.first(4) + + assert_equal 'x', 'x'.last + assert_equal 'x', 'x'.last(4) end def test_starts_ends_with |