Perl Diver 2.31
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

Test2::V0

Name Test2::V0
Version 0.000144
Located at /usr/local/share/perl5
File /usr/local/share/perl5/Test2/V0.pm
Is Core No
Search CPAN for this module Test2::V0
Documentation Test2::V0
Module Details Test2::V0


NAME

Test2::V0 - 0Th edition of the Test2 recommended bundle.


DESCRIPTION

This is the big-daddy bundle. This bundle includes nearly every tool, and several plugins, that the Test2 author uses. This bundle is used extensively to test the Test2::Suite manpage itself.


NAMING, USING, DEPENDING

This bundle should not change in a severely incompatible way. Some minor breaking changes, specially bugfixes, may be allowed. If breaking changes are needed then a new Test2::V# module should be released instead.

As new V# modules are released old ones may be moved to different cpan distributions. You should always use a specific bundle version and list that version in your distributions testing requirements. You should never simply list the Test2::Suite manpage as your modules dep, instead list the specific bundle, or tools and plugins you use directly in your metadata.


SYNOPSIS

    use Test2::V0;
    ok(1, "pass");
    ...
    done_testing;


RESOLVING CONFLICTS WITH MOOSE

    use Test2::V0 '!meta';

Moose and the Test2::V0 manpage both export very different meta() subs. Adding '!meta' to the import args will prevent the sub from being imported. This bundle also exports the sub under the name meta_check() so you can use that spelling as an alternative.

TAGS

:DEFAULT
The following are both identical:
    use Test2::V0;
    use Test2::V0 ':DEFAULT';

RENAMING ON IMPORT

    use Test2::V0 ':DEFAULT', '!ok', ok => {-as => 'my_ok'};

This bundle uses Importer for exporting, as such you can use any arguments it accepts.

Explanation:

'!ok'
Do not export ok()

ok => {-as => 'my_ok'}
Actually, go ahead and import ok() but under the name my_ok().

If you did not add the '!ok' argument then you would have both ok() and my_ok()


PRAGMAS

All of these can be disabled via individual import arguments, or by the -no_pragmas argument.

    use Test2::V0 -no_pragmas => 1;

STRICT

the strict manpage is turned on for you. You can disable this with the -no_strict or -no_pragmas import arguments:

    use Test2::V0 -no_strict => 1;

WARNINGS

the warnings manpage are turned on for you. You can disable this with the -no_warnings or -no_pragmas import arguments:

    use Test2::V0 -no_warnings => 1;

UTF8

This is actually done via the the Test2::Plugin::UTF8 manpage plugin, see the PLUGINS section for details.

Note: -no_pragmas => 1 will turn off the entire plugin.


PLUGINS

SRAND

See the Test2::Plugin::SRand manpage.

This will set the random seed to today's date. You can provide an alternate seed with the -srand import option:

    use Test2::V0 -srand => 1234;

UTF8

See the Test2::Plugin::UTF8 manpage.

This will set the file, and all output handles (including formatter handles), to utf8. This will turn on the utf8 pragma for the current scope.

This can be disabled using the -no_utf8 => 1 or -no_pragmas => 1 import arguments.

    use Test2::V0 -no_utf8 => 1;

EXIT SUMMARY

See the Test2::Plugin::ExitSummary manpage.

This plugin has no configuration.


API FUNCTIONS

See the Test2::API manpage for these

$ctx = context()
$events = intercept { ... }


TOOLS

TARGET

See the Test2::Tools::Target manpage.

You can specify a target class with the -target import argument. If you do not provide a target then $CLASS and CLASS() will not be imported.

    use Test2::V0 -target => 'My::Class';
    print $CLASS;  # My::Class
    print CLASS(); # My::Class

Or you can specify names:

    use Test2::V0 -target => { pkg => 'Some::Package' };
    pkg()->xxx; # Call 'xxx' on Some::Package
    $pkg->xxx;  # Same
$CLASS
Package variable that contains the target class name.

$class = CLASS()
Constant function that returns the target class name.

DEFER

See the Test2::Tools::Defer manpage.

def $func => @args;
do_def()

BASIC

See the Test2::Tools::Basic manpage.

ok($bool, $name)
ok($bool, $name, @diag)ok($bool, $name, @diag)
pass($name)
pass($name, @diag)pass($name, @diag)
fail($name)
fail($name, @diag)fail($name, @diag)
diag($message)
note($message)
$todo = todo($reason)
todo $reason => sub { ... }
skip($reason, $count)
plan($count)
skip_all($reason)
done_testing()
bail_out($reason)

COMPARE

See the Test2::Tools::Compare manpage.

is($got, $want, $name)
isnt($got, $do_not_want, $name)
like($got, qr/match/, $name)
unlike($got, qr/mismatch/, $name)
$check = match(qr/pattern/)
$check = mismatch(qr/pattern/)
$check = validator(sub { return $bool })
$check = hash { ... }
$check = array { ... }
$check = bag { ... }
$check = object { ... }
$check = meta { ... }
$check = number($num)
$check = string($str)
$check = check_isa($class_name)
$check = in_set(@things)
$check = not_in_set(@things)
$check = check_set(@things)
$check = item($thing)
$check = item($idx => $thing)$check = item($idx => $thing)
$check = field($name => $val)
$check = call($method => $expect)
$check = call_list($method => $expect)
$check = call_hash($method => $expect)
$check = prop($name => $expect)
$check = check($thing)
$check = T()
$check = F()
$check = D()
$check = DF()
$check = E()
$check = DNE()
$check = FDNE()
$check = U()
$check = L()
$check = exact_ref($ref)
end()
etc()
filter_items { grep { ... } @_ }
$check = event $type => ...
@checks = fail_events $type => ...

CLASSIC COMPARE

See the Test2::Tools::ClassicCompare manpage.

cmp_ok($got, $op, $want, $name)

SUBTEST

See the Test2::Tools::Subtest manpage.

subtest $name => sub { ... };
(Note: This is called subtest_buffered() in the Tools module.)

CLASS

See the Test2::Tools::Class manpage.

can_ok($thing, @methods)
isa_ok($thing, @classes)
DOES_ok($thing, @roles)

ENCODING

See the Test2::Tools::Encoding manpage.

set_encoding($encoding)

EXPORTS

See the Test2::Tools::Exports manpage.

imported_ok('function', '$scalar', ...)
not_imported_ok('function', '$scalar', ...)

REF

See the Test2::Tools::Ref manpage.

ref_ok($ref, $type)
ref_is($got, $want)
ref_is_not($got, $do_not_want)

MOCK

See the Test2::Tools::Mock manpage.

$control = mock ...
$bool = mocked($thing)

EXCEPTION

See the Test2::Tools::Exception manpage.

$exception = dies { ... }
$bool = lives { ... }
$bool = try_ok { ... }

WARNINGS

See the Test2::Tools::Warnings manpage.

$count = warns { ... }
$warning = warning { ... }
$warnings_ref = warnings { ... }
$bool = no_warnings { ... }


SOURCE

The source code repository for Test2-Suite can be found at https://github.com/Test-More/Test2-Suite/.


MAINTAINERS

Chad Granum


AUTHORS

Chad Granum <exodist@cpan.org>Chad Granum


COPYRIGHT

Copyright 2018 Chad Granum <exodist@cpan.org>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://dev.perl.org/licenses/

Perl Diver brought to you by ScriptSolutions.com © 1997- 2024