diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-09 14:19:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-09 14:19:38 +0000 |
commit | 4b346b0e7159d95ed0afce0840adaf62d7c1381f (patch) | |
tree | 5634fe875af3082fd84a5b4be48c6f6463c767f7 /test | |
parent | fa8920288c8d0ede2806a33c465a8e79f73cf0fd (diff) | |
download | ruby-4b346b0e7159d95ed0afce0840adaf62d7c1381f.tar.gz |
test_hash.rb: add test
* test/ruby/test_hash.rb (test_try_convert): Add test for
Hash.try_convert. [Fix GH-1190]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_hash.rb | 8 |
1 files changed, 8 insertions, 0 deletions
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[ |