Test::Lazy is a quick and easy way to compose and run tests with useful output.
SYNOPSIS
use Test::Lazy qw/check try/;
check(1 => is => 1);
check(0 => isnt => 1);
check(a => like => qr/[a-zA-Z]/);
check(0 => unlike => qr/a-zA-Z]/);
check(1 => '>' => 0);
check(0 => '. See `perldoc -m Test::Lazy` for more detail.
Note, if < expected> is an ARRAY or HASH, this function will convert it to it's JSON representation before comparison.
try("2 + 2" => '==' => 5);
# This will produce the following output:
# Failed test '2 + 2 == 5'
# at __FILE__ line __LINE__.
# got: '4'
# expected: '5'
check( < got>, < cmpr>, < expected>, [ < msg> ] )
Compare < got> to < expected> using < cmpr>. Optionally provide a < msg> to display on failure. If < msg> is not given, then one will be automatically made from < got>, < cmpr>, and < expected>.
Note, if < got> or < expected> is an ARRAY or HASH, this function will convert them to their JSON representation before comparison.
check([qw/a b/] => is => [qw/a b c/]);
# This will produce the following output:
# Failed test '["a","b"] is ["a","b","c"]'
# at __FILE__ line __LINE__.
# got: '["a","b"]'
# expected: '["a","b","c"]'
template( ... )
Convenience function for creating a Test::Lazy::Template. All arguments are directly passed to Test::Lazy::Template-new>.
See Test::Lazy::Template for more details.
Returns a new Test::Lazy::Template object.
cmpr
< cmpr> can be one of the following:
ok, not_ok, is, isnt, like, unlike,
, =, lt, gt, le, ge, ==, !=, eq, ne,
Product's homepage
Requirements:
· Perl