Test2::Tools::Tiny(3p) Perl Programmers Reference Guide

Test2::Tools::Tiny(3p) Perl Programmers Reference Guide #

Test2::Tools::Tiny(3p) Perl Programmers Reference Guide

NNAAMMEE #

 Test2::Tools::Tiny - Tiny set of tools for unfortunate souls who cannot
 use Test2::Suite.

DDEESSCCRRIIPPTTIIOONN #

 You should really look at Test2::Suite. This package is some very basic
 essential tools implemented using Test2. This exists only so that Test2
 and other tools required by Test2::Suite can be tested. This is the
 package Test2 uses to test itself.

UUSSEE TTeesstt22::::SSuuiittee IINNSSTTEEAADD Use Test2::Suite if at all possible.

EEXXPPOORRTTSS #

 ok($bool, $name)
 ok($bool, $name, @diag)
     Run a simple assertion.

 is($got, $want, $name)
 is($got, $want, $name, @diag)
     Assert that 2 strings are the same.

 isnt($got, $do_not_want, $name)
 isnt($got, $do_not_want, $name, @diag)
     Assert that 2 strings are not the same.

 like($got, $regex, $name)
 like($got, $regex, $name, @diag)
     Check that the input string matches the regex.

 unlike($got, $regex, $name)
 unlike($got, $regex, $name, @diag)
     Check that the input string does not match the regex.

 is_deeply($got, $want, $name)
 is_deeply($got, $want, $name, @diag)
     Check 2 data structures. Please note that this is a _D_U_M_B
     implementation that compares the output of Data::Dumper against both
     structures.

 diag($msg)
     Issue a diagnostics message to STDERR.

 note($msg)
     Issue a diagnostics message to STDOUT.

 skip_all($reason)
     Skip all tests.

 todo $reason => sub { ... }
     Run a block in TODO mode.

 plan($count)
     Set the plan.

 ddoonnee__tteessttiinngg(())
     Set the plan to the current test count.

 $warnings = warnings { ... }
     Capture an arrayref of warnings from the block.

 $exception = exception { ... }
     Capture an exception.

 tests $name => sub { ... }
     Run a subtest.

 $output = capture { ... }
     Capture STDOUT and STDERR output.

     Result looks like this:

         {

STDOUT => “…”, #

STDERR => “…”, #

         }

SSOOUURRCCEE #

 The source code repository for Test2 can be found at
 _h_t_t_p_:_/_/_g_i_t_h_u_b_._c_o_m_/_T_e_s_t_-_M_o_r_e_/_t_e_s_t_-_m_o_r_e_/.

MMAAIINNTTAAIINNEERRSS #

 Chad Granum <exodist@cpan.org>

AAUUTTHHOORRSS #

 Chad Granum <exodist@cpan.org>

CCOOPPYYRRIIGGHHTT #

 Copyright 2020 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 _h_t_t_p_:_/_/_d_e_v_._p_e_r_l_._o_r_g_/_l_i_c_e_n_s_e_s_/

perl v5.36.3 2023-02-15 Test2::Tools::Tiny(3p)