diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/ruby/test_hash.rb | 8 |
2 files changed, 13 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Sat Jan 9 23:19:14 2016 Kuniaki IGARASHI <igaiga@gmail.com> + + * 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@users.noreply.github.com> * 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[ |