This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Check that the key is present before a delete, and absent afterwards
authorNicholas Clark <nick@ccl4.org>
Fri, 21 Nov 2003 23:15:47 +0000 (23:15 +0000)
committerNicholas Clark <nick@ccl4.org>
Fri, 21 Nov 2003 23:15:47 +0000 (23:15 +0000)
p4raw-id: //depot/perl@21767

ext/XS/APItest/t/hash.t

index 2d3f19d..5c6398a 100644 (file)
@@ -145,10 +145,18 @@ sub test_delete_present {
     tie %$copy, ref $class;
   }
   $copy = {%$hash};
+  ok (brute_force_exists ($copy, $key),
+      "hv_delete_ent present$message $printable");
   is (delete $copy->{$key}, $key, "hv_delete_ent present$message $printable");
+  ok (!brute_force_exists ($copy, $key),
+      "hv_delete_ent present$message $printable");
   $copy = {%$hash};
+  ok (brute_force_exists ($copy, $key),
+      "hv_delete present$message $printable");
   is (XS::APItest::Hash::delete ($copy, $key), $key,
       "hv_delete present$message $printable");
+  ok (!brute_force_exists ($copy, $key),
+      "hv_delete present$message $printable");
 }
 
 sub test_delete_absent {