[前][次][番号順一覧][スレッド一覧]

ruby-changes:41312

From: nobu <ko1@a...>
Date: Wed, 30 Dec 2015 16:43:32 +0900 (JST)
Subject: [ruby-changes:41312] nobu:r53384 (trunk): Add test for String#ord

nobu	2015-12-30 16:43:25 +0900 (Wed, 30 Dec 2015)

  New Revision: 53384

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53384

  Log:
    Add test for String#ord
    
    * test/ruby/test_string.rb (test_ord): Add test for String#ord.
      [Fix GH-1181]

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_string.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53383)
+++ ChangeLog	(revision 53384)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Dec 30 16:43:23 2015  Kuniaki IGARASHI  <igaiga@g...>
+
+	* 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@r...>
 
 	* lib/forwardable.rb (def_instance_delegator): adjust backtrace of
Index: test/ruby/test_string.rb
===================================================================
--- test/ruby/test_string.rb	(revision 53383)
+++ test/ruby/test_string.rb	(revision 53384)
@@ -2342,6 +2342,13 @@ class TestString < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L2342
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]