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

ruby-changes:41415

From: nobu <ko1@a...>
Date: Sat, 9 Jan 2016 23:19:20 +0900 (JST)
Subject: [ruby-changes:41415] nobu:r53487 (trunk): test_hash.rb: add test

nobu	2016-01-09 23:19:38 +0900 (Sat, 09 Jan 2016)

  New Revision: 53487

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

  Log:
    test_hash.rb: add test
    
    * test/ruby/test_hash.rb (test_try_convert): Add test for
      Hash.try_convert.  [Fix GH-1190]

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_hash.rb
Index: test/ruby/test_hash.rb
===================================================================
--- test/ruby/test_hash.rb	(revision 53486)
+++ test/ruby/test_hash.rb	(revision 53487)
@@ -148,6 +148,14 @@ class TestHash < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_hash.rb#L148
 
   end
 
+  def test_try_convert
+    assert_equal({1=>2}, Hash.try_convert({1=>2}))
+    assert_equal(nil, Hash.try_convert("1=>2"))
+    o = Object.new
+    def o.to_hash; {3=>4} end
+    assert_equal({3=>4}, Hash.try_convert(o))
+  end
+
   def test_AREF # '[]'
     t = Time.now
     h = @cls[
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53486)
+++ ChangeLog	(revision 53487)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Jan  9 23:19:14 2016  Kuniaki IGARASHI  <igaiga@g...>
+
+	* test/ruby/test_hash.rb (test_try_convert): Add test for
+	  Hash.try_convert.  [Fix GH-1190]
+
 Sat Jan  9 23:15:25 2016  Jon Moss  <maclover7@u...>
 
 	* ext/openssl/ossl.c: Add missing variables to documentation

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

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