1Test2::Tools::Tiny(3) User Contributed Perl DocumentationTest2::Tools::Tiny(3)
2
3
4
6 Test2::Tools::Tiny - Tiny set of tools for unfortunate souls who cannot
7 use Test2::Suite.
8
10 You should really look at Test2::Suite. This package is some very basic
11 essential tools implemented using Test2. This exists only so that Test2
12 and other tools required by Test2::Suite can be tested. This is the
13 package Test2 uses to test itself.
14
16 Use Test2::Suite if at all possible.
17
19 ok($bool, $name)
20 ok($bool, $name, @diag)
21 Run a simple assertion.
22
23 is($got, $want, $name)
24 is($got, $want, $name, @diag)
25 Assert that 2 strings are the same.
26
27 isnt($got, $do_not_want, $name)
28 isnt($got, $do_not_want, $name, @diag)
29 Assert that 2 strings are not the same.
30
31 like($got, $regex, $name)
32 like($got, $regex, $name, @diag)
33 Check that the input string matches the regex.
34
35 unlike($got, $regex, $name)
36 unlike($got, $regex, $name, @diag)
37 Check that the input string does not match the regex.
38
39 is_deeply($got, $want, $name)
40 is_deeply($got, $want, $name, @diag)
41 Check 2 data structures. Please note that this is a DUMB
42 implementation that compares the output of Data::Dumper against
43 both structures.
44
45 diag($msg)
46 Issue a diagnostics message to STDERR.
47
48 note($msg)
49 Issue a diagnostics message to STDOUT.
50
51 skip_all($reason)
52 Skip all tests.
53
54 todo $reason => sub { ... }
55 Run a block in TODO mode.
56
57 plan($count)
58 Set the plan.
59
60 done_testing()
61 Set the plan to the current test count.
62
63 $warnings = warnings { ... }
64 Capture an arrayref of warnings from the block.
65
66 $exception = exception { ... }
67 Capture an exception.
68
69 tests $name => sub { ... }
70 Run a subtest.
71
72 $output = capture { ... }
73 Capture STDOUT and STDERR output.
74
75 Result looks like this:
76
77 {
78 STDOUT => "...",
79 STDERR => "...",
80 }
81
83 The source code repository for Test2 can be found at
84 http://github.com/Test-More/test-more/.
85
87 Chad Granum <exodist@cpan.org>
88
90 Chad Granum <exodist@cpan.org>
91
93 Copyright 2020 Chad Granum <exodist@cpan.org>.
94
95 This program is free software; you can redistribute it and/or modify it
96 under the same terms as Perl itself.
97
98 See http://dev.perl.org/licenses/
99
100
101
102perl v5.36.0 2023-03-15 Test2::Tools::Tiny(3)