VERSION

This document describes Test::Carp version 0.2

SYNOPSIS

    use Test::More tests => 42;
    use Test::Carp;

    ok($x eq $y, "X does equal Y");
    does_carp(\&function);
    does_croak(\&function, 1, 2, 3);
    does_carp_that_matches(\&function, qr/whoopsy/);
    does_croak_that_matches(\&function, 1, 2, 3, qr/a likely story/);

DESCRIPTION

Call given code (with given arguments) and tests whether the given Carp function (or their imported versions) are called (with a given value) or not.

INTERFACE

All functions are put in the caller's name space during import(). If you'd rather use their full name space and not clutter up the current package with functions just:

require Test::Carp;

or

use Test::Carp ();

instead of

use Test::Carp;

being \fIok()\fP w/ \fIok()\fP

Internally, Test::Carp uses Test::More::ok() (require()ing in Test::More if needed) when it needs to use an ok() function.

If you want to specify a different one for it to use simply supply a coderef in the use statement.

use Test::Carp \&Test::Foo::ok;

The function should take the same args as Test::More::ok() and probably behave the same as well.

\fIcarp()\fP/\fIcluck()\fP functions

does_carp()

Test whether the given code ref, when executed, calls carp(). Test fails if carp() is not called. There are 2 forms: Without arguments to codreref: does_carp(sub {...}); With arge to coderef: does_carp(sub {...},"first arg to coderef", "second arg to coderef", ...);

does_carp_that_matches()

Test whether the given code ref, when executed, calls carp() with a specific message. The test fails if carp() is not called with the given message. The last argument should be a string or Regexp ref (i.e. qr//) to match the message against. There are 2 forms: Without arguments passed to codreref: does_carp(sub {...}, $match_me) With arguments passed to coderef: does_carp(sub {...},"first arg to coderef", "second arg to coderef", ..., $match_me);

does_cluck

Like does_carp() but for cluck()

does_cluck_that_matches

Like does_carp_that_matches() but for cluck()

\fIcroak()\fP/\fIconfess()\fP functions

These functions stop running at the point it calls the [croak|cluck]() just like in normal code.

does_croak()

Like does_carp() but for croak()

does_croak_that_matches()

Like does_carp_that_matches() but for croak()

does_confess()

Like does_carp() but for confess()

does_confess_that_matches()

Like does_carp_that_matches() but for confess()

DIAGNOSTICS

Throws no warnings or errors of it's own.

CONFIGURATION AND ENVIRONMENT

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

DEPENDENCIES

Test::More for ok() unless you define a different ok() for it to use.

It uses Carp in order to ensure carp and corak are defined before it does what it does.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to \*(C`[email protected]\*(C', or through the web interface at <http://rt.cpan.org>.

TODO

Corresponding does_not_* functions. (v0.2)

TODOs in 02.functions.t (v0.2)

Maybe count and overall call info type functions, depending on demand ?

Determine [what needs done/if it should be done/etc] to make the test syntax not require a codref ?

Add mostly-internal Carp functions like (short|long)mess[_heavy](), etc ?

AUTHOR

Daniel Muey \*(C`<http://drmuey.com/cpan_contact.pl>\*(C'

LICENCE AND COPYRIGHT

Copyright (c) 2010, Daniel Muey \*(C`<http://drmuey.com/cpan_contact.pl>\*(C'. 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

\s-1BECAUSE\s0 \s-1THIS\s0 \s-1SOFTWARE\s0 \s-1IS\s0 \s-1LICENSED\s0 \s-1FREE\s0 \s-1OF\s0 \s-1CHARGE\s0, \s-1THERE\s0 \s-1IS\s0 \s-1NO\s0 \s-1WARRANTY\s0 \s-1FOR\s0 \s-1THE\s0 \s-1SOFTWARE\s0, \s-1TO\s0 \s-1THE\s0 \s-1EXTENT\s0 \s-1PERMITTED\s0 \s-1BY\s0 \s-1APPLICABLE\s0 \s-1LAW\s0. \s-1EXCEPT\s0 \s-1WHEN\s0 \s-1OTHERWISE\s0 \s-1STATED\s0 \s-1IN\s0 \s-1WRITING\s0 \s-1THE\s0 \s-1COPYRIGHT\s0 \s-1HOLDERS\s0 \s-1AND/OR\s0 \s-1OTHER\s0 \s-1PARTIES\s0 \s-1PROVIDE\s0 \s-1THE\s0 \s-1SOFTWARE\s0 \*(L"\s-1AS\s0 \s-1IS\s0\*(R" \s-1WITHOUT\s0 \s-1WARRANTY\s0 \s-1OF\s0 \s-1ANY\s0 \s-1KIND\s0, \s-1EITHER\s0 \s-1EXPRESSED\s0 \s-1OR\s0 \s-1IMPL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