Skip to content

Commit 5a0a0f8

Browse files
committed
Update other docs
1 parent a730649 commit 5a0a0f8

File tree

10 files changed

+233
-51
lines changed

10 files changed

+233
-51
lines changed

lib/Test2/API/InterceptResult.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ needing a deep understanding of the event/facet model.
186186
Usually you get an instance of this class when you use C<intercept()> from
187187
L<Test2::API>.
188188
189-
use Test2::V0;
189+
use Test2::V1 '-iPp';
190190
use Test2::API qw/intercept/;
191191
192192
my $events = intercept {

lib/Test2/API/InterceptResult/Event.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ you to use when testing your test tools.
507507
508508
=head1 SYNOPSIS
509509
510-
use Test2::V0;
510+
use Test2::V1 '-iPp';
511511
use Test2::API qw/intercept/;
512512
513513
my $events = intercept {

lib/Test2/Bundle/Extended.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ Test2::Bundle::Extended - Old name for Test2::V0
3333
This bundle has been renamed to L<Test2::V0>, in which the C<':v1'> tag has
3434
been removed as unnecessary.
3535
36+
B<Note:> L<Test2::V1> is the latest bundle, you probably want to look at that.
37+
3638
=head1 DESCRIPTION
3739
3840
This is the big-daddy bundle. This bundle includes nearly every tool, and

lib/Test2/Manual/Testing.pm

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ lexically scoped, or they may be global.
3939
=item Test2::Bundle::*
4040
4141
Bundles combine toolsets and plugins together to reduce your boilerplate. First
42-
time test writers are encouraged to start with the L<Test2::V0> bundle (which
42+
time test writers are encouraged to start with the L<Test2::V1> bundle (which
4343
is an exception to the namespace rule as it does not live under
4444
C<Test2::Bundle::>). If you find yourself loading several plugins and toolsets
4545
over and over again you could benefit from writing your own bundle.
@@ -69,47 +69,47 @@ and define new ones, typically with a new bundle. In short, if we feel the need
6969
to break something we will do so by creating a new bundle, and discouraging the
7070
old one, but we will not break the old one.
7171
72-
So for example, if you use L<Test2::V0>, and L<Dist::Zilla> you
72+
So for example, if you use L<Test2::V1>, and L<Dist::Zilla> you
7373
should have this in your config:
7474
7575
[Prereqs / TestRequires]
76-
Test2::V0 = 0.000060
76+
Test2::V1 = 0.000060
7777
7878
You B<SHOULD NOT> do this:
7979
8080
[Prereqs / TestRequires]
8181
Test2::Suite = 0.000060
8282
83-
Because L<Test2::V0> might not always be part of L<Test2::Suite>.
83+
Because L<Test2::V1> might not always be part of L<Test2::Suite>.
8484
8585
When writing new tests you should often check L<Test2::Suite> to see what the
8686
current recommended bundle is.
8787
8888
=head3 Dist::Zilla
8989
9090
[Prereqs / TestRequires]
91-
Test2::V0 = 0.000060
91+
Test2::V1 = 0.000060
9292
9393
=head3 ExtUtils::MakeMaker
9494
9595
my %WriteMakefileArgs = (
9696
...,
9797
"TEST_REQUIRES" => {
98-
"Test2::V0" => "0.000060"
98+
"Test2::V1" => "0.000060"
9999
},
100100
...
101101
);
102102
103103
=head3 Module::Install
104104
105-
test_requires 'Test2::V0' => '0.000060';
105+
test_requires 'Test2::V1' => '0.000060';
106106
107107
=head3 Module::Build
108108
109109
my $build = Module::Build->new(
110110
...,
111111
test_requires => {
112-
"Test2::V0" => "0.000060",
112+
"Test2::V1" => "0.000060",
113113
},
114114
...
115115
);

lib/Test2/Manual/Testing/Introduction.pm

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ C<.t> file extension.
2626
2727
C<t/example.t>:
2828
29-
use Test2::V0;
29+
use Test2::V1 -ipP;
3030
3131
# Assertions will go here
3232
@@ -36,10 +36,26 @@ This is all the boilerplate you need.
3636
3737
=over 4
3838
39-
=item use Test2::V0;
39+
=item use Test2::V1 -ipP;
4040
4141
This loads a collection of testing tools that will be described later in the
42-
tutorial. This will also turn on C<strict> and C<warnings> for you.
42+
tutorial. See L<Test2::V1> for more details, but for starters '-ipP' is a good
43+
set of import flags.
44+
45+
If you do not like importing a ton of symbols or enabling pragmas/plugins all
46+
in one swoop you can do C<< use Test2::V1; >>. If you do this you will need to
47+
use the T2() function to access tools, and load any pragmas/plugins manually:
48+
49+
use Test2::V1;
50+
use strict;
51+
use warnings;
52+
use Test2::Plugin::UTF8;
53+
use Test2::Plugin::SRand;
54+
55+
T2->ok(1, "pass");
56+
T2->is(5, 5, "5 is 5");
57+
58+
T2->done_testing;
4359
4460
=item done_testing;
4561
@@ -59,28 +75,28 @@ L<Test2::Suite> to their own dists at any time.
5975
=head3 Dist::Zilla
6076
6177
[Prereqs / TestRequires]
62-
Test2::V0 = 0.000060
78+
Test2::V1 = 0.000060
6379
6480
=head3 ExtUtils::MakeMaker
6581
6682
my %WriteMakefileArgs = (
6783
...,
6884
"TEST_REQUIRES" => {
69-
"Test2::V0" => "0.000060"
85+
"Test2::V1" => "0.000060"
7086
},
7187
...
7288
);
7389
7490
=head3 Module::Install
7591
76-
test_requires 'Test2::V0' => '0.000060';
92+
test_requires 'Test2::V1' => '0.000060';
7793
7894
=head3 Module::Build
7995
8096
my $build = Module::Build->new(
8197
...,
8298
test_requires => {
83-
"Test2::V0" => "0.000060",
99+
"Test2::V1" => "0.000060",
84100
},
85101
...
86102
);
@@ -94,12 +110,20 @@ that a condition is true.
94110
95111
Here is a complete C<t/example.t>:
96112
97-
use Test2::V0;
113+
use Test2::V1 -import;
98114
99115
ok(1, "1 is true, so this will pass");
100116
101117
done_testing;
102118
119+
If you are doing it without imports:
120+
121+
use Test2::V1;
122+
123+
T2->ok(1, "1 is true, so this will pass");
124+
125+
T2->done_testing;
126+
103127
=head1 RUNNING THE TEST
104128
105129
Test files are simply scripts. Just like any other script you can run the test
@@ -204,13 +228,17 @@ There are 2 primary ways to set the plan:
204228
205229
=item done_testing()
206230
231+
=item T2->done_testing()
232+
207233
The most common, and recommended way to set a plan is to add C<done_testing> at
208234
the end of your test file. This will automatically calculate the plan for you
209235
at the end of the test. If the test were to exit early then C<done_testing>
210236
would not run and no plan would be found, forcing a failure.
211237
212238
=item plan($COUNT)
213239
240+
=item T2->plan($COUNT)
241+
214242
The C<plan()> function allows you to specify an exact number of assertions you
215243
want to run. If you run too many or too few assertions then the plan will not
216244
match and it will be counted as a failure. The primary problem with this way of
@@ -224,13 +252,15 @@ cannot be done in the middle of making assertions.
224252
225253
=head1 ADDITIONAL ASSERTION TOOLS
226254
227-
The L<Test2::V0> bundle provides a lot more than C<ok()>,
255+
The L<Test2::V1> bundle provides a lot more than C<ok()>,
228256
C<plan()>, and C<done_testing()>. The biggest tools to note are:
229257
230258
=over 4
231259
232260
=item is($a, $b, $description)
233261
262+
=item T2->is($a, $b, $description)
263+
234264
C<is()> allows you to compare 2 structures and insure they are identical. You
235265
can use it for simple string comparisons, or even deep data structure
236266
comparisons.
@@ -241,6 +271,8 @@ comparisons.
241271
242272
=item like($a, $b, $description)
243273
274+
=item T2->like($a, $b, $description)
275+
244276
C<like()> is similar to C<is()> except that it only checks items listed on the
245277
right, it ignores any extra values found on the left.
246278

0 commit comments

Comments
 (0)