aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_string.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-30 07:43:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-30 07:43:25 +0000
commit4eb52f78408400266a6f08f4d26cd4559f31678f (patch)
treee35c8987be787e166edbd48260c79f3903f11e6e /test/ruby/test_string.rb
parent2e26fa48ffade18988e63eb9e0c9f9e2d7474576 (diff)
downloadruby-4eb52f78408400266a6f08f4d26cd4559f31678f.tar.gz
Add test for String#ord
* test/ruby/test_string.rb (test_ord): Add test for String#ord. [Fix GH-1181] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r--test/ruby/test_string.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 00e1f5f8ff..72fca75b29 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -2342,6 +2342,13 @@ class TestString < Test::Unit::TestCase
assert_not_equal(str.object_id, (+str).object_id)
assert_equal(str.object_id, (-str).object_id)
end
+
+ def test_ord
+ assert_equal(97, "a".ord)
+ assert_equal(97, "abc".ord)
+ assert_equal(0x3042, "\u3042\u3043".ord)
+ assert_raise(ArgumentError) { "".ord }
+ end
end
class TestString2 < TestString