The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::Simpler - Simpler than Test::Simple; more powerful than Test::More

VERSION

This document describes Test::Simpler version 0.000007

SYNOPSIS

    use Test::Simpler tests => 6;

    # and later...

    ok  $result -  $expected[0];
    ok  $result eq $expected[0];
    ok  $result == $expected->[0]->{a}[0];
    ok  $result ~~ $expected[0];
    ok  $result !~ $expected[0];
    ok  $result >  twice($expected{'half'});

DESCRIPTION

This module acts as a drop-in replacement for Test::Simple. It provides exactly the same interface (i.e. a single subroutine named ok()), but produces TAP reports whose diagnostics are considerably more detailed and informative than those of either Test::Simple or Test::More.

For example, using Test::Simple the set of ok() tests above would produce:

    1..6
    not ok 1
    #   Failed test at demo/ts_ok.pl line 14.
    ok 2
    not ok 3
    #   Failed test at demo/ts_ok.pl line 16.
    ok 4
    not ok 5
    #   Failed test at demo/ts_ok.pl line 18.
    not ok 6
    #   Failed test at demo/ts_ok.pl line 19.
    # Looks like you failed 4 tests of 6.

giving no indication of what caused each test to fail.

Whereas, using Test::Simpler with the same size statements, you would get:

    1..6
    not ok 1 - $result - $expected[0]
    #   Failed test at demo/ts_ok-er.pl line 14
    #   Expected true value for:  $result - $expected[0]
    #   But was false because:
    #       $result      --> 1
    #       $expected[0] --> 1
    #
    ok 2 - $result eq $expected[0]
    not ok 3 - $result == $expected->[0]->{a}[0]
    #   Failed test at demo/ts_ok-er.pl line 16
    #       $result
    #         isn't ==
    #       $expected->[0]->{a}[0]
    #   Because:
    #       $result                --> 1
    #       $expected->[0]->{a}[0] --> undef
    #
    ok 4 - $result ~~ $expected[0]
    not ok 5 - $result !~ $expected[0]
    #   Failed test at demo/ts_ok-er.pl line 18
    #       $result
    #         isn't !~
    #       $expected[0]
    #   Because:
    #       $result      --> 1
    #       $expected[0] --> 1
    #
    not ok 6 - $result > double($hash{'b b'})
    #   Failed test at demo/ts_ok-er.pl line 19
    #       $result
    #         isn't >
    #       twice($hash{'half'})
    #   Because:
    #       $result       --> 1
    #       $hash{'half'} --> 2
    #
    # Looks like you failed 4 tests of 6.

INTERFACE

The module's API is identical to Test::Simple. See that module's documentation for details.

DIAGNOSTICS

Can't understand arguments to ok()

The module was unable to parse the arguments you passed to ok(). Or, more precisely, PPI was not able to. That must be some freaky arcane Perl expression you used there! Maybe try a simpler test condition?

CONFIGURATION AND ENVIRONMENT

Test::Simpler requires no configuration files or environment variables.

DEPENDENCIES

Requires:

PPI

...to parse the arguments of ok()

Test::Builder::Module

...to produce TAP reports and to emulate the Test::Simple interface.

PadWalker

...to track variable values

Data::Dump

...to print variable values

(Which means it's only simpler on the outside ;-)

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to bug-test-simpler@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Damian Conway <DCONWAY@CPAN.org>

LICENCE AND COPYRIGHT

Copyright (c) 2012, Damian Conway <DCONWAY@CPAN.org>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.