summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-23 14:18:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-23 14:18:32 +0000
commitd4c22161f391d66ae6191c36f5f2ff965f97c3f6 (patch)
tree2855023fda5c2eba19466b34c3134bb68ded271c
parentca7835bec6714f0704a32a25d2c23e465f3c10b2 (diff)
downloadruby-d4c22161f391d66ae6191c36f5f2ff965f97c3f6.tar.gz
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
-rw-r--r--ext/-test-/hash/delete.c4
-rw-r--r--test/-ext-/hash/test_delete.rb4
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