aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/string_ext_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/core_ext/string_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb
index f394509dd1..34d4057cf9 100644
--- a/activesupport/test/core_ext/string_ext_test.rb
+++ b/activesupport/test/core_ext/string_ext_test.rb
@@ -67,4 +67,18 @@ class StringInflectionsTest < Test::Unit::TestCase
assert_equal Time.local(2005, 2, 27, 23, 50), "2005-02-27 23:50".to_time(:local)
assert_equal Date.new(2005, 2, 27), "2005-02-27".to_date
end
+
+ def test_access
+ s = "hello"
+ assert_equal "h", s.at(0)
+
+ assert_equal "llo", s.from(2)
+ assert_equal "hel", s.to(2)
+
+ assert_equal "h", s.first
+ assert_equal "he", s.first(2)
+
+ assert_equal "o", s.last
+ assert_equal "llo", s.last(3)
+ end
end