GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Test2::Bundle::Extended(3) User Contributed Perl Documentation Test2::Bundle::Extended(3)

Test2::Bundle::Extended - Old name for Test2::V0

This bundle has been renamed to Test2::V0, in which the ':v1' tag has been removed as unnecessary.

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 Test2::Suite itself.

    use Test2::Bundle::Extended ':v1';

    ok(1, "pass");

    ...

    done_testing;

    use Test2::Bundle::Extended '!meta';

Moose and Test2::Bundle::Extended 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.

:v1
:DEFAULT
The following are all identical:

    use Test2::Bundle::Extended;

    use Test2::Bundle::Extended ':v1';

    use Test2::Bundle::Extended ':DEFAULT';
    

    use Test2::Bundle::Extended ':v1', '!ok', ok => {-as => 'my_ok'};

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

Explanation:

':v1'
Use the default tag, all default exports.
'!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()"

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

    use Test2::Bundle::Extended -no_pragmas => 1;

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

    use Test2::Bundle::Extended -no_strict => 1;

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

    use Test2::Bundle::Extended -no_warnings => 1;

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

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

See Test2::Plugin::SRand.

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

    use Test2::Bundle::Extended -srand => 1234;

See Test2::Plugin::UTF8.

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::Bundle::Extended -no_utf8 => 1;

See Test2::Plugin::ExitSummary.

This plugin has no configuration.

See Test2::API for these
$ctx = context()
$events = intercept { ... }

See Test2::Tools::Target.

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::Bundle::Extended -target => 'My::Class';

    print $CLASS;  # My::Class
    print CLASS(); # My::Class

Or you can specify names:

    use Test2::Bundle::Extended -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.

See Test2::Tools::Defer.
def $func => @args;
do_def()

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

See Test2::Tools::Compare.
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 = 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 => ...

See Test2::Tools::ClassicCompare.
cmp_ok($got, $op, $want, $name)

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

See Test2::Tools::Class.
can_ok($thing, @methods)
isa_ok($thing, @classes)
DOES_ok($thing, @roles)

See Test2::Tools::Encoding.
set_encoding($encoding)

See Test2::Tools::Exports.
imported_ok('function', '$scalar', ...)
not_imported_ok('function', '$scalar', ...)

See Test2::Tools::Ref.
ref_ok($ref, $type)
ref_is($got, $want)
ref_is_not($got, $do_not_want)

See Test2::Tools::Mock.
$control = mock ...
$bool = mocked($thing)

See Test2::Tools::Exception.
$exception = dies { ... }
$bool = lives { ... }
$bool = try_ok { ... }

See Test2::Tools::Warnings.
$count = warns { ... }
$warning = warning { ... }
$warnings_ref = warnings { ... }
$bool = no_warnings { ... }

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

Chad Granum <exodist@cpan.org>

Chad Granum <exodist@cpan.org>

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/

2022-03-04 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.