diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-01-24 04:29:07 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-01-24 04:29:07 +0000 |
commit | d03199b6d6cedc9c5d1059aa58e5211af6b479b3 (patch) | |
tree | 567b4463c00d4aea8411be514d9fc1d003542114 /test/ruby/test_object.rb | |
parent | 498838c6627c82befd3c6dcd5c5d6870b38db5e7 (diff) | |
download | ruby-d03199b6d6cedc9c5d1059aa58e5211af6b479b3.tar.gz |
* object.c (rb_Hash): trivial optimization.
* test/ruby/test_object.rb (TestObject#test_convert_hash): fix
arguments order.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_object.rb')
-rw-r--r-- | test/ruby/test_object.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb index 15e7b72e35..8d8fd8f847 100644 --- a/test/ruby/test_object.rb +++ b/test/ruby/test_object.rb @@ -198,14 +198,14 @@ class TestObject < Test::Unit::TestCase end def test_convert_hash - assert_equal(Hash(nil), {}) - assert_equal(Hash([]), {}) - assert_equal(Hash(key: :value), {key: :value}) + assert_equal({}, Hash(nil)) + assert_equal({}, Hash([])) + assert_equal({key: :value}, Hash(key: :value)) assert_raise(TypeError) { Hash([1,2]) } assert_raise(TypeError) { Hash(Object.new) } o = Object.new def o.to_hash; {a: 1, b: 2}; end - assert_equal(Hash(o), {a: 1, b: 2}) + assert_equal({a: 1, b: 2}, Hash(o)) def o.to_hash; 9; end assert_raise(TypeError) { Hash(o) } end |