Tools?

What are tools?

In Test2, Tools are functions that produce testing events.


What is a "testing event"?

Events are generated whenever you make an assertions, set a plan, or produce diagnostics.


Where can I find tools?

Test2 makes the Test2::Tools::* mamespaces available to anyone who wants to write new tools.


Please note: not all tools are listed here.

Basic

Test2::Tools::Basic

These are the 'essential' tools you always want handy.

See the module documentation for more.

Class

Test2::Tools::Class

These are tools to help you verify your classes.

* Note: isa_ok() takes different arguments compared to Test::More::isa_ok()

See the module documentation for more.
Compare

Test2::Tools::Compare

This has been moved to its own section above, see the "compare" section.
Defer

Test2::Tools::Defer

Record values now, but run test later.
Encoding

Test2::Tools::Encoding


Correctly set the output encoding for the test.
This seems trivial, but it is something that was very hard to do with Test::Builder.
Exception

Test2::Tools::Exception


This is similar to Test::Fatal, but it intentionally does much less.
Exports

Test2::Tools::Exports

This provides tools to verifiy that methods are present in your namespace. This is intended to verify exports.
Ref

Test2::Tools::Ref

Tools for validating and comparing references.

Setup: ref_ok() can check that something is a ref, or a ref of a specific type: ref_is() can check that 2 refs are the same exact ref: ref_is_not() is the opposite:
Subtest

Test2::Tools::Subtest

This provides tools for writing buffered or unbuffered subtests. 'Buffered' is the new Test2 style. The old Test::More style is 'streamed': Note: Test2::V0 provides subtest() which is buffered.
Warnings

Test2::Tools::Warnings

This is a collection of tools that can be used to test code that issues warnings.