1Test2::Bundle::More(3)User Contributed Perl DocumentationTest2::Bundle::More(3)
2
3
4

NAME

6       Test2::Bundle::More - ALMOST a drop-in replacement for Test::More.
7

DESCRIPTION

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

SYNOPSIS

13           use Test2::Bundle::More;
14
15           ok(1, "pass");
16
17           ...
18
19           done_testing;
20

PLUGINS

22       This loads Test2::Plugin::ExitSummary.
23

TOOLS

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() in
57       that package.
58
59       subtest $name => sub { ... }
60

KEY DIFFERENCES FROM Test::More

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 your
74           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 @isa.
84
85               isa_ok($thing, $class1, $class2, ...);
86
87   THESE FUNCTIONS AND VARIABLES HAVE BEEN REMOVED
88       $TODO
89           See todo().
90
91       use_ok()
92       require_ok()
93           These are not necessary. Use "use" and "require" directly. If there
94           is an error loading the module the test will catch the error and
95           fail.
96
97       todo_skip()
98           Not necessary.
99
100       eq_array()
101       eq_hash()
102       eq_set()
103           Discouraged in Test::More.
104
105       explain()
106           This started a fight between Test developers, who may now each
107           write their own implementations in Test2. (See explain in
108           Test::Most vs Test::More.  Hint: Test::Most wrote it first, then
109           Test::More added it, but broke compatibility).
110
111       new_ok()
112           Not necessary.
113

SOURCE

115       The source code repository for Test2-Suite can be found at
116       https://github.com/Test-More/Test2-Suite/.
117

MAINTAINERS

119       Chad Granum <exodist@cpan.org>
120

AUTHORS

122       Chad Granum <exodist@cpan.org>
123
125       Copyright 2018 Chad Granum <exodist@cpan.org>.
126
127       This program is free software; you can redistribute it and/or modify it
128       under the same terms as Perl itself.
129
130       See http://dev.perl.org/licenses/
131
132
133
134perl v5.36.0                      2023-03-23            Test2::Bundle::More(3)
Impressum