Skip to content

Commit

Permalink
Merge pull request #7 from manwar/add-method-no-skip
Browse files Browse the repository at this point in the history
Add method no skip
  • Loading branch information
davorg authored Aug 2, 2019
2 parents d9b7429 + d42290f commit 979fd84
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/Array/Compare.pm
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,9 @@ or:
my %skip = (1 => 1, 2 => 2);
$comp->Skip(\%skip);
To reset the comparator so that no longer skips elements, set the skip
hash to an empty hash.
To reset the comparator so that no longer skips elements, call NoSkip().
$comp->Skip({});
$comp->NoSkip();
You can also check to see if one array is a permutation of another, i.e.
they contain the same elements but in a different order.
Expand Down Expand Up @@ -228,6 +227,18 @@ a reference to a hash which contains the numbers of any columns that should
be skipped in the comparison. Default is an empty hash (all columns are
significant).
=item NoSkip
Reset skipped column details. It assigns {} to the attribute C<Skip>.
=cut

sub NoSkip {
my $self = shift;

$self->{Skip} = {};
}

=item DefFull
Flag which indicates whether the default comparison is simple (just returns
Expand Down
4 changes: 4 additions & 0 deletions t/test.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ ok(not $comp->compare(\@A, \@B));
$comp->Skip(\%skip1);
ok($comp->compare(\@A, \@B));

# Compare two different arrays after reset Skip - should fail
$comp->NoSkip();
ok(not $comp->compare(\@A, \@B));

# compare two different arrays but ignore non-differing column - should fail
$comp->Skip(\%skip2);
ok(not $comp->compare(\@A, \@B));
Expand Down

0 comments on commit 979fd84

Please sign in to comment.