Lines Matching defs:Test

1 package Test::More;
6 use Test::Builder;
35 my $Test = Test::Builder->new;
51 Test::More - yet another framework for writing test scripts
55 use Test::More tests => $Num_Tests;
57 use Test::More qw(no_plan);
59 use Test::More skip_all => $reason;
106 my @status = Test::More::status;
115 Test::Simple first. This is a drop in replacement for Test::Simple
131 The preferred way to do this is to declare a plan when you C<use Test::More>.
133 use Test::More tests => $Num_Tests;
139 use Test::More qw(no_plan);
143 use Test::More skip_all => $skip_reason;
146 exit immediately with a zero (success). See L<Test::Harness> for
149 If you want to control what functions Test::More will export, you
153 use Test::More tests => 23, import => ['!fail'];
158 use Test::More;
163 use Test::More;
165 plan skip_all => 'Test irrelevant on MacOS';
178 $Test->exported_to($caller);
189 $Test->plan(@plan);
200 =head2 Test names
263 This is actually Test::Simple's ok() routine.
269 $Test->ok($test, $name);
332 $Test->is_eq(@_);
336 $Test->isnt_eq(@_);
373 $Test->like(@_);
387 $Test->unlike(@_);
425 $Test->cmp_ok(@_);
463 my $ok = $Test->ok( 0, "$class->can(...)" );
464 $Test->diag(' can_ok() called with no methods');
479 my $ok = $Test->ok( !@nok, $name );
481 $Test->diag(map " $class->can('$_') failed\n", @nok);
511 (for example 'Test customer').
556 $ok = $Test->ok( 0, $name );
557 $Test->diag(" $diag\n");
560 $ok = $Test->ok( 1, $name );
585 $Test->ok(1, @_);
589 $Test->ok(0, @_);
629 $Test->diag(@_);
691 my $ok = $Test->ok( !$@, "use $module;" );
695 $Test->diag(<<DIAGNOSTIC);
724 my $ok = $Test->ok( !$@, "require $module;" );
728 $Test->diag(<<DIAGNOSTIC);
750 L<Test::Harness>.
752 The way Test::More handles this is with a named block. Basically, a
783 code I<won't be run at all>. Test::More will output special ok's
784 which Test::Harness interprets as skipped, but passing, tests.
789 the label C<SKIP>, or Test::More can't work its magic.
804 unless $Test::Builder::No_Plan;
809 $Test->skip($why);
839 With a todo block, the tests inside are expected to fail. Test::More
841 they are "todo". Test::Harness will interpret failures as being ok.
870 tests will be marked as failing but todo. Test::Harness will
881 unless $Test::Builder::No_Plan;
886 $Test->todo_skip($why);
911 instances, Test::More provides a handful of useful functions.
927 Barrie Slaymaker's Test::Differences module provides more in-depth
928 functionality along these lines, and it plays well with Test::More.
941 $ok = $Test->is_eq($this, $that, $name);
946 $ok = $Test->ok(1, $name);
949 $ok = $Test->ok(0, $name);
950 $ok = $Test->diag(_format_stack(@Data_Stack));
1133 =head2 Extending and Embedding Test::More
1135 Sometimes the Test::More interface isn't quite enough. Fortunately,
1136 Test::More is built on top of Test::Builder which provides a single,
1138 libraries which both use Test::Builder B<can be used together in the
1142 you can access the underlying Test::Builder object like so:
1148 my $test_builder = Test::More->builder;
1150 Returns the Test::Builder object underlying Test::More for you to play
1156 return Test::Builder->new;
1164 Test::More is B<explicitly> tested all the way back to perl 5.004.
1166 Test::More is thread-safe for perl 5.8.0 and up.
1174 If you are trying to extend Test::More, don't. Use Test::Builder
1179 =item Test::Harness upgrades
1181 no_plan and todo depend on new Test::Harness features and fixes. If
1183 end-users will have to upgrade Test::Harness to the latest one on
1184 CPAN. If you avoid no_plan and TODO tests, the stock Test::Harness
1187 If you simply depend on Test::More, it's own dependencies will cause a
1188 Test::Harness upgrade.
1195 This is a case of convergent evolution with Joshua Pritikin's Test
1198 figure out how to easily wedge test names into Test's interface (along
1203 providing more flexibility than the existing Test.pm. As such, the
1210 L<Test::Simple> if all this confuses you and you just want to write
1211 some tests. You can upgrade to Test::More later (it's forward
1214 L<Test::Differences> for more ways to test complex data structures.
1215 And it plays well with Test::More.
1217 L<Test> is the old testing module. Its main benefit is that it has
1220 L<Test::Harness> for details on how your test results are interpreted
1223 L<Test::Unit> describes a very featureful unit testing interface.
1225 L<Test::Inline> shows the idea of embedded testing.
1233 from Joshua Pritikin's Test module and lots of help from Barrie