Test2::Tools::Tiny(3)

πŸ“¦ version 1.302214, in opensuse-leap 16.0

πŸ’– NAME πŸ’–

Okay bestie, welcome to Test2::Tools::Tiny(3) β€” a user-contributed Perl documentation page for the Tiny set of tools for unfortunate souls who cannot use Test2::Suite. 🫢

🌸 DESCRIPTION 🌸

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. ✨

πŸ›‘ USE Test2::Suite INSTEAD πŸ›‘

Use Test2::Suite if at all possible. Like, fr fr, please. πŸ’…

πŸ’… EXPORTS πŸ’…

  • ok($bool, $name) or ok($bool, $name, @diag) β€” run a simple assertion.
  • is($got, $want, $name) or is($got, $want, $name, @diag) β€” assert that 2 strings are the same.
  • isnt($got, $do_not_want, $name) or isnt($got, $do_not_want, $name, @diag) β€” assert that 2 strings are not the same.
  • like($got, $regex, $name) or like($got, $regex, $name, @diag) β€” check that the input string matches the regex.
  • unlike($got, $regex, $name) or unlike($got, $regex, $name, @diag) β€” check that the input string does not match the regex.
  • is_deeply($got, $want, $name) or is_deeply($got, $want, $name, @diag) β€” check 2 data structures. Please note that this is a DUMB 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.
  • done_testing() β€” 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 => "...",
}

πŸ”— SOURCE πŸ”—

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

πŸ‘‘ MAINTAINERS πŸ‘‘

Chad Granum <exodist@cpan.org>

✍️ AUTHORS ✍️

Chad Granum <exodist@cpan.org>

Copyright 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 https://dev.perl.org/licenses/


Okay bye bestie! This page came from perl v5.42.0, dated 2025-07-28 β€” slay and test responsibly πŸ’…βœ¨

πŸ“¦ where this page comes from