[前][次][番号順一覧][スレッド一覧]

ruby-changes:36034

From: nobu <ko1@a...>
Date: Thu, 23 Oct 2014 23:18:47 +0900 (JST)
Subject: [ruby-changes:36034] nobu:r48115 (trunk): test/-ext-/hash/test_delete.rb: assert deleted values

nobu	2014-10-23 23:18:32 +0900 (Thu, 23 Oct 2014)

  New Revision: 48115

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48115

  Log:
    test/-ext-/hash/test_delete.rb: assert deleted values

  Modified files:
    trunk/ext/-test-/hash/delete.c
    trunk/test/-ext-/hash/test_delete.rb
Index: ext/-test-/hash/delete.c
===================================================================
--- ext/-test-/hash/delete.c	(revision 48114)
+++ ext/-test-/hash/delete.c	(revision 48115)
@@ -4,11 +4,11 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/ext/-test-/hash/delete.c#L4
 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);
 }
Index: test/-ext-/hash/test_delete.rb
===================================================================
--- test/-ext-/hash/test_delete.rb	(revision 48114)
+++ test/-ext-/hash/test_delete.rb	(revision 48115)
@@ -8,10 +8,10 @@ class TestHash < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/-ext-/hash/test_delete.rb#L8
       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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]