1Test2::Bundle::More(3)User Contributed Perl DocumentationTest2::Bundle::More(3)
2
3
4
6 Test2::Bundle::More - ALMOST a drop-in replacement for Test::More.
7
9 This bundle is intended to be a (mostly) drop-in replacement for
10 Test::More. See "KEY DIFFERENCES FROM Test::More" for details.
11
13 use Test2::Bundle::More;
14
15 ok(1, "pass");
16
17 ...
18
19 done_testing;
20
22 This loads Test2::Plugin::ExitSummary.
23
25 These are from Test2::Tools::Basic. See Test2::Tools::Basic for
26 details.
27
28 ok($bool, $name)
29 pass($name)
30 fail($name)
31 skip($why, $count)
32 $todo = todo($why)
33 diag($message)
34 note($message)
35 plan($count)
36 skip_all($why)
37 done_testing()
38 BAIL_OUT($why)
39
40 These are from Test2::Tools::ClassicCompare. See
41 Test2::Tools::ClassicCompare for details.
42
43 is($got, $want, $name)
44 isnt($got, $donotwant, $name)
45 like($got, qr/match/, $name)
46 unlike($got, qr/mismatch/, $name)
47 is_deeply($got, $want, "Deep compare")
48 cmp_ok($got, $op, $want, $name)
49
50 These are from Test2::Tools::Class. See Test2::Tools::Class for
51 details.
52
53 isa_ok($thing, @classes)
54 can_ok($thing, @subs)
55
56 This is from Test2::Tools::Subtest. It is called "subtest_streamed()"
57 in that package.
58
59 subtest $name => sub { ... }
60
62 You cannot plan at import.
63 THIS WILL NOT WORK:
64
65 use Test2::Bundle::More tests => 5;
66
67 Instead you must plan in a separate statement:
68
69 use Test2::Bundle::More;
70 plan 5;
71
72 You have three subs imported for use in planning
73 Use "plan($count)", "skip_all($reason)", or "done_testing()" for
74 your planning.
75
76 isa_ok accepts different arguments
77 "isa_ok" in Test::More was:
78
79 isa_ok($thing, $isa, $alt_thing_name);
80
81 This was very inconsistent with tools like "can_ok($thing, @subs)".
82
83 In Test2::Bundle::More, "isa_ok()" takes a $thing and a list of
84 @isa.
85
86 isa_ok($thing, $class1, $class2, ...);
87
88 THESE FUNCTIONS AND VARIABLES HAVE BEEN REMOVED
89 $TODO
90 See "todo()".
91
92 use_ok()
93 require_ok()
94 These are not necessary. Use "use" and "require" directly. If there
95 is an error loading the module the test will catch the error and
96 fail.
97
98 todo_skip()
99 Not necessary.
100
101 eq_array()
102 eq_hash()
103 eq_set()
104 Discouraged in Test::More.
105
106 explain()
107 This started a fight between Test developers, who may now each
108 write their own implementations in Test2. (See explain in
109 Test::Most vs Test::More. Hint: Test::Most wrote it first, then
110 Test::More added it, but broke compatibility).
111
112 new_ok()
113 Not necessary.
114
116 The source code repository for Test2-Suite can be found at
117 https://github.com/Test-More/Test2-Suite/.
118
120 Chad Granum <exodist@cpan.org>
121
123 Chad Granum <exodist@cpan.org>
124
126 Copyright 2018 Chad Granum <exodist@cpan.org>.
127
128 This program is free software; you can redistribute it and/or modify it
129 under the same terms as Perl itself.
130
131 See http://dev.perl.org/licenses/
132
133
134
135perl v5.34.0 2021-11-16 Test2::Bundle::More(3)