Skip to content

Commit

Permalink
Perlito5 - tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fglock committed Oct 13, 2017
1 parent 2709363 commit 6996493
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions t/test.pl
Expand Up @@ -463,34 +463,34 @@ sub eq_array {
return 1;
}

#### sub eq_hash {
#### my ($orig, $suspect) = @_;
#### my $fail;
#### while (my ($key, $value) = each %$suspect) {
#### # 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) {
#### _print "# key ", _qq($key), " was ", _qq($orig->{$key}),
#### " now ", _qq($value), "\n";
#### $fail = 1;
#### }
#### } else {
#### _print "# key ", _qq($key), " is ", _qq($value),
#### ", not in original.\n";
#### $fail = 1;
#### }
#### }
#### foreach (keys %$orig) {
#### # Force a hash recompute if this perl's internals can cache the hash key.
#### $_ = "" . $_;
#### next if (exists $suspect->{$_});
#### _print "# key ", _qq($_), " was ", _qq($orig->{$_}), " now missing.\n";
#### $fail = 1;
#### }
#### !$fail;
#### }
####
sub eq_hash {
my ($orig, $suspect) = @_;
my $fail;
while (my ($key, $value) = each %$suspect) {
# 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) {
_print "# key ", _qq($key), " was ", _qq($orig->{$key}),
" now ", _qq($value), "\n";
$fail = 1;
}
} else {
_print "# key ", _qq($key), " is ", _qq($value),
", not in original.\n";
$fail = 1;
}
}
foreach (keys %$orig) {
# Force a hash recompute if this perl's internals can cache the hash key.
$_ = "" . $_;
next if (exists $suspect->{$_});
_print "# key ", _qq($_), " was ", _qq($orig->{$_}), " now missing.\n";
$fail = 1;
}
!$fail;
}

#### # We only provide a subset of the Test::More functionality.
#### sub require_ok ($) {
#### my ($require) = @_;
Expand Down

0 comments on commit 6996493

Please sign in to comment.