diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-30 07:43:25 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-30 07:43:25 +0000 |
commit | f880d5dcd26d429a223068aa30bf2062dd6b4ad8 (patch) | |
tree | e35c8987be787e166edbd48260c79f3903f11e6e | |
parent | 6fd18ca51bbce302865d23632b15af53d3e8f11b (diff) | |
download | ruby-f880d5dcd26d429a223068aa30bf2062dd6b4ad8.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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/ruby/test_string.rb | 7 |
2 files changed, 12 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Wed Dec 30 16:43:23 2015 Kuniaki IGARASHI <igaiga@gmail.com> + + * test/ruby/test_string.rb (test_ord): Add test for String#ord. + [Fix GH-1181] + Wed Dec 30 11:28:57 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> * lib/forwardable.rb (def_instance_delegator): adjust backtrace of 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 |