Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
moregan committed Nov 29, 2014
1 parent 65db67c commit eeec47a
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions t/lib/PPI/Test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use strict;

use vars qw{$VERSION @ISA @EXPORT_OK %EXPORT_TAGS};
BEGIN {
$VERSION = '1.216_01';
$VERSION = '1.220';
@ISA = 'Exporter';
%EXPORT_TAGS = (
'cmp' => [ qw(
Expand Down Expand Up @@ -40,47 +40,46 @@ elements one by one against C<expected>, failing the test if the
two do not compare correctly.
The variant C<cmp_sdocument> ignores insignificant elements in the
document so that you omit them from C<expected>.
document so that you can omit them from C<expected>.
The contents of C<expected> dictate how the comparison is done.
Each element of C<expected> is a hashref that describes how to
Each element of C<expected> is a hashref whose keys describe how to
compare it to the corresponding element from the parse.
Hash keys supported:
=over 4
=item class:
=item class
The value of C<class> is compared to the parsed element's class.
=item isa:
=item isa
The value of C<isa> is passed to an isa call on parsed element.
=item name of any method on the parsed PPI element:
Any hash key not otherwise document is used as a method name on the parsed
element being compared, and the results must match the hash key's value.
If the element being compared does not have that method, the test
Any hash key not otherwise documented is used as a method name on the
parsed element; the results of the method call must match the hash key's
value. If the element being compared does not have that method, the test
will fail.
=item FUNC:
=item FUNC
The value for this attribute is a sub that accepts the parsed element
as its argument. Execute as many tests on anything you like in the
sub. E.g.:
as its argument, along with a test description. Execute as many tests
on anything you like in the sub. E.g.:
FUNC => sub {
my ( $elem, $msg ) = @_;
is_deeply( [$elem->foo()], [1, 2, 3], "$msg: testing foo" );
my ( $elem, $msg ) = @_;
is_deeply( [$elem->foo()], [1, 2, 3], "$msg: testing foo" );
}
The return value of the sub is ignored.
=item STOP:
=item STOP
When the key STOP appears with a true value in a hash in C<expected>,
comparison stops after that hash has been compared. Test success or
failure is the result of that last comparison.
When the key STOP appears with a true value in C<expected>,
comparison stops after that hash has been compared.
=back
Expand Down Expand Up @@ -216,7 +215,7 @@ you don't have to have a C<PPI::Document> element at the beginning of
C<expected>.
The variant C<cmp_sstatement> ignores insignificant elements in the
document so that you omit them from C<expected>.
document so that you can omit them from C<expected>.
C<expected> can be passed as a hashref if you have only one element to
compare.
Expand Down Expand Up @@ -276,7 +275,7 @@ You can also pass a listref of hashes for C<expected>, in which case
all elements in C<expected> must match.
The variant C<cmp_selement> ignores insignificant elements in the
document so that you omit them from C<expected>.
document so that you can omit them from C<expected>.
The return is true for a successful test, false otherwise.
Expand Down

0 comments on commit eeec47a

Please sign in to comment.