NAME

Test::Tiny -- Write simple tests, simply.

SYNOPSIS

use Test::Tiny tests => NUMBER;
ok(TEST [, MESSAGE]);    # pass if TEST is true, and print MESSAGE
show(TEST);              # pass if eval(TEST) is true, print TEST
SKIP: {
    skip(MESSAGE, N);
    # skip this code, including N tests
}
BAIL_OUT([MESSAGE]);        # give up, printing MESSAGE.

DESCRIPTION

I thought Test::Simple was simple, but then I realized it relies on Test::Builder to implement the one function it exports. Test::Tiny does more with less:

ok(TEST [, MESSAGE])

Print "ok N - MESSAGE" if TEST is true, and "not ok N - MESSAGE" otherwise. The MESSAGE is optional.

show(EXPRESSION)

show is like ok, but uses eval(EXPRESSION) as the TEST, and uses EXPRESSION as the MESSAGE. This is useful when your test is self-explanatory:

ok sqrt(4) == 2, 'sqrt(4) is 2'; # redundant
show 'sqrt(4) == 2';             # non-redundant

skip(MESSAGE, NUMBER)

Skip NUMBER tests with reason MESSAGE:

SKIP: {
    skip "message", $number;
    # tests go here.
}

BAIL_OUT(REASON)

Stop testing for REASON.

done_testing

Indicate that you finished running your tests.

SEE ALSO

Test::Simple, Test::More, Test::Builder.

AUTHOR

Sean O'Rourke <seano@cpan.org>.

Bug reports welcome, patches even more welcome.

Test::Tiny doesn't try to be 100% compatible with Test::Simple, but should stay clean, clear, and under 5% of Test::Simple's lines (from Simple.pm, Builder.pm, and files in @INC/Builder). Current counts are:

Test::Tiny    52   SLOC, 144  lines
Test::Simple  1345 SLOC, 3612 lines

COPYRIGHT

Copyright (C) 2010, 2011, Sean O'Rourke. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.