From d4c22161f391d66ae6191c36f5f2ff965f97c3f6 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 23 Oct 2014 14:18:32 +0000 Subject: [PATCH] test/-ext-/hash/test_delete.rb: assert deleted values git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/-test-/hash/delete.c | 4 ++-- test/-ext-/hash/test_delete.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/-test-/hash/delete.c b/ext/-test-/hash/delete.c index de54e3694f..c0489e0ab7 100644 --- a/ext/-test-/hash/delete.c +++ b/ext/-test-/hash/delete.c @@ -4,11 +4,11 @@ static VALUE hash_delete(VALUE hash, VALUE key) { VALUE ret = rb_hash_delete(hash, key); - return ret == Qundef ? Qfalse : Qtrue; + return ret == Qundef ? Qnil : rb_ary_new_from_values(1, &ret); } void Init_delete(VALUE klass) { - rb_define_method(klass, "delete", hash_delete, 1); + rb_define_method(klass, "delete!", hash_delete, 1); } diff --git a/test/-ext-/hash/test_delete.rb b/test/-ext-/hash/test_delete.rb index d4f2023e75..13f3595482 100644 --- a/test/-ext-/hash/test_delete.rb +++ b/test/-ext-/hash/test_delete.rb @@ -8,10 +8,10 @@ class TestHash < Test::Unit::TestCase hash[1] = 2 called = false assert_equal 1, hash.size - assert_equal true, hash.delete(1) {called = true} + assert_equal [2], hash.delete!(1) {called = true} assert_equal false, called, "block called" assert_equal 0, hash.size - assert_equal false, hash.delete(1) {called = true} + assert_equal nil, hash.delete!(1) {called = true} assert_equal false, called, "block called" assert_equal 0, hash.size end