NAME
Kit - vars::i test kit
SYNOPSIS
Test helpers. These make it easier to trap undefined variables using string eval and use strict
.
FUNCTIONS
eval_dies_ok
eval_dies_ok "Code string" [, "message"];
Runs the code string; tests that the code died. Any exception will be reported at the same line in the caller as the eval_dies_ok
invocation.
eval_lives_ok
eval_lives_ok "Code string" [, "message"];
Runs the code string; tests that the code did not throw an exception.
eval_dies_like
eval_dies_like "Code string", qr/regex/ [, "message"];
Runs the code string; tests that the code threw an exception matching regex
.
eval_is_var
eval_is_var '$Package::var', value [, "message"];
Tests that $Package::var
exists, and that $Package::var eq value
.
line_mark_string
Add a #line
directive to a string. Usage:
my $str = line_mark_string <<EOT ;
$contents
EOT
or
my $str = line_mark_string __FILE__, __LINE__, <<EOT ;
$contents
EOT
In the first form, information from caller
will be used for the filename and line number.
The #line
directive will point to the line after the line_mark_string
invocation, i.e., the first line of <C$contents>. Generally, $contents
will be source code, although this is not required.
$contents
must be defined, but can be empty.
import
Exports the functions using Exporter --- all functions are exported by default. Also loads Test::More into the caller.