- or download this
use strict;
use warnings;
...
} else {
croak "Contract failed: ".$c->get_tap;
};
- or download this
sub refute {
my ($condition, $message) = @_;
ok (!$condition, $message)
or diag $condition;
};
- or download this
package My::Check;
use Exporter qw(import);
...
}, args => 2, export => 1;
1;
- or download this
use Test::More tests => 1;
use My::Check;
my_check $foo, $bar, "foo is fine";
- or download this
# inside a running application
use Test::Contract;
use My::Check(); # don't pollute global namespace
...
if (!$c->get_passing) {
# ouch, something went wrong with $foo and $bar
};
- or download this
use Test::More;
use Test::Contract::Unit qw(contract_is);
use My::Check;
...
is_contract $c, "1100", "my_check works as expected";
done_testing;