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

ruby-changes:38287

From: gogotanaka <ko1@a...>
Date: Wed, 22 Apr 2015 12:48:52 +0900 (JST)
Subject: [ruby-changes:38287] gogotanaka:r50368 (trunk): * test/ruby/test_object.rb: add tests for Kernel#String and Kernel#Array.

gogotanaka	2015-04-22 12:48:23 +0900 (Wed, 22 Apr 2015)

  New Revision: 50368

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

  Log:
    * test/ruby/test_object.rb: add tests for Kernel#String and Kernel#Array.
      [fix GH-879][fix GH-880] Patch by @yui-knk

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_object.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50367)
+++ ChangeLog	(revision 50368)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Apr 22 12:42:12 2015  Kazuki Tanaka  <gogotanaka@r...>
+
+	* test/ruby/test_object.rb: add tests for Kernel#String and Kernel#Array.
+	  [fix GH-879][fix GH-880] Patch by @yui-knk
+
 Tue Apr 21 20:46:02 2015  SHIBATA Hiroshi  <hsbt@r...>
 
 	* test/ruby/test_object.rb: renamed tests to explicitly class name.
Index: test/ruby/test_object.rb
===================================================================
--- test/ruby/test_object.rb	(revision 50367)
+++ test/ruby/test_object.rb	(revision 50368)
@@ -244,6 +244,8 @@ class TestObject < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_object.rb#L244
     assert_raise(TypeError) { String(o) }
     def o.to_s; "o"; end
     assert_equal("o", String(o))
+    def o.to_str; "O"; end
+    assert_equal("O", String(o))
     def o.respond_to?(*) false; end
     assert_raise(TypeError) { String(o) }
   end
@@ -254,6 +256,8 @@ class TestObject < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_object.rb#L256
     assert_raise(TypeError) { Array(o) }
     def o.to_a; [1]; end
     assert_equal([1], Array(o))
+    def o.to_ary; [2]; end
+    assert_equal([2], Array(o))
     def o.respond_to?(*) false; end
     assert_equal([o], Array(o))
   end

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

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