Kit - vars::i test kit
Test helpers. These make it easier to trap undefined variables using string eval and use strict.
use strict
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_dies_ok
eval_lives_ok "Code string" [, "message"];
Runs the code string; tests that the code did not throw an exception.
eval_dies_like "Code string", qr/regex/ [, "message"];
Runs the code string; tests that the code threw an exception matching regex.
regex
eval_is_var '$Package::var', value [, "message"];
Tests that $Package::var exists, and that $Package::var eq value.
$Package::var
$Package::var eq value
Add a #line directive to a string. Usage:
#line
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.
caller
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.
line_mark_string
$contents
$contents must be defined, but can be empty.
Exports the functions using Exporter --- all functions are exported by default. Also loads Test::More into the caller.
To install vars::i, copy and paste the appropriate command in to your terminal.
cpanm
cpanm vars::i
CPAN shell
perl -MCPAN -e shell install vars::i
For more information on module installation, please visit the detailed CPAN module installation guide.