@@ -26,7 +26,7 @@ C<.t> file extension.
2626
2727C<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
4141This 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
95111Here 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
105129Test 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+
207233The most common, and recommended way to set a plan is to add C<done_testing > at
208234the end of your test file. This will automatically calculate the plan for you
209235at the end of the test. If the test were to exit early then C<done_testing >
210236would not run and no plan would be found, forcing a failure.
211237
212238=item plan($COUNT)
213239
240+ =item T2->plan($COUNT)
241+
214242The C<plan() > function allows you to specify an exact number of assertions you
215243want to run. If you run too many or too few assertions then the plan will not
216244match 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() > ,
228256C<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+
234264C<is() > allows you to compare 2 structures and insure they are identical. You
235265can use it for simple string comparisons, or even deep data structure
236266comparisons.
@@ -241,6 +271,8 @@ comparisons.
241271
242272=item like($a, $b, $description)
243273
274+ =item T2->like($a, $b, $description)
275+
244276C<like() > is similar to C<is() > except that it only checks items listed on the
245277right, it ignores any extra values found on the left.
246278
0 commit comments