aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-06-27 13:08:38 -0300
committerJosé Valim <jose.valim@gmail.com>2010-06-27 20:30:24 +0200
commitfa96638bf2c5c97571849715cb8298c7a3b058ca (patch)
tree241b5346b815c5575bc36abd8be3f73e0cbf07cc /activesupport/test
parent0c0b0aa0f223523331afdc157fb3992a121bf497 (diff)
downloadrails-fa96638bf2c5c97571849715cb8298c7a3b058ca.tar.gz
rails-fa96638bf2c5c97571849715cb8298c7a3b058ca.tar.bz2
rails-fa96638bf2c5c97571849715cb8298c7a3b058ca.zip
Added getbyte as a core_ext to Ruby < 1.9
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb
index d9702dd9ff..affa1b5e18 100644
--- a/activesupport/test/core_ext/string_ext_test.rb
+++ b/activesupport/test/core_ext/string_ext_test.rb
@@ -110,6 +110,14 @@ class StringInflectionsTest < Test::Unit::TestCase
assert_equal 97, 'abc'.ord
end
+ if RUBY_VERSION < '1.9'
+ def test_getbyte
+ assert_equal 97, 'a'.getbyte(0)
+ assert_equal 99, 'abc'.getbyte(2)
+ assert_nil 'abc'.getbyte(3)
+ end
+ end
+
def test_string_to_time
assert_equal Time.utc(2005, 2, 27, 23, 50), "2005-02-27 23:50".to_time
assert_equal Time.local(2005, 2, 27, 23, 50), "2005-02-27 23:50".to_time(:local)