test.pl: allow for undefs in eq_hash
authorHugo van der Sanden <hv@crypt.org>
Mon, 29 Oct 2012 23:31:21 +0000 (23:31 +0000)
committerHugo van der Sanden <hv@crypt.org>
Fri, 2 Nov 2012 09:28:12 +0000 (09:28 +0000)
It should be possible to compare hashes with undef values without
triggering warnings.

t/test.pl

index 0f0caa9..c4e6fd1 100644 (file)
--- a/t/test.pl
+++ b/t/test.pl
@@ -497,7 +497,10 @@ sub eq_hash {
     # Force a hash recompute if this perl's internals can cache the hash key.
     $key = "" . $key;
     if (exists $orig->{$key}) {
-      if ($orig->{$key} ne $value) {
+      if (
+        defined $orig->{$key} != defined $value
+        || (defined $value && $orig->{$key} ne $value)
+      ) {
         _print "# key ", _qq($key), " was ", _qq($orig->{$key}),
                      " now ", _qq($value), "\n";
         $fail = 1;