diff --git a/ChangeLog b/ChangeLog index 9a2af0fd98..f6b1d601d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Jan 9 23:19:14 2016 Kuniaki IGARASHI + + * 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 * ext/openssl/ossl.c: Add missing variables to documentation diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 6ee029722a..3baba6a0b7 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -148,6 +148,14 @@ class TestHash < Test::Unit::TestCase 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[