Lines Matching defs:Test

1 package Test::Builder;
16 # Make Test::Builder thread-safe for ithreads.
41 Test::Builder - Backend for building test libraries
45 package My::Test::Module;
46 use Test::Builder;
51 my $Test = Test::Builder->new;
52 $Test->output('my_logfile');
58 $Test->exported_to($pack);
59 $Test->plan(@_);
67 $Test->ok($test, $name);
73 Test::Simple and Test::More have proven to be popular testing modules,
74 but they're not always flexible enough. Test::Builder provides the a
84 my $Test = Test::Builder->new;
86 Returns a Test::Builder object representing the current state of the
90 Test::Builder object. No matter how many times you call new(), you're
95 my $Test;
98 $Test ||= bless ['Move along, nothing to see here'], $class;
99 return $Test;
113 my $pack = $Test->exported_to;
114 $Test->exported_to($pack);
116 Tells Test::Builder what package you exported your functions to.
133 $Test->plan('no_plan');
134 $Test->plan( skip_all => $reason );
135 $Test->plan( tests => $num_tests );
137 A convenient way to set up your tests. Call this and Test::Builder
183 my $max = $Test->expected_tests;
184 $Test->expected_tests($max);
207 $Test->no_plan;
221 $plan = $Test->has_plan
236 $Test->skip_all;
237 $Test->skip_all($reason);
262 Test::More.
270 $Test->ok($test, $name);
273 like Test::Simple's ok().
317 $name =~ s|#|\\#|g; # # in a name can confuse Test::Harness.
351 $Test->is_eq($got, $expected, $name);
353 Like Test::More's is(). Checks if $got eq $expected. This is the
358 $Test->is_num($got, $expected, $name);
360 Like Test::More's is(). Checks if $got == $expected. This is the
425 $Test->isnt_eq($got, $dont_expect, $name);
427 Like Test::More's isnt(). Checks if $got ne $dont_expect. This is
432 $Test->is_num($got, $dont_expect, $name);
434 Like Test::More's isnt(). Checks if $got ne $dont_expect. This is
474 $Test->like($this, qr/$regex/, $name);
475 $Test->like($this, '/$regex/', $name);
477 Like Test::More's like(). Checks if $this matches the given $regex.
483 $Test->unlike($this, qr/$regex/, $name);
484 $Test->unlike($this, '/$regex/', $name);
486 Like Test::More's unlike(). Checks if $this B<does not match> the
507 $Test->maybe_regex(qr/$regex/);
508 $Test->maybe_regex('/$regex/');
581 $Test->cmp_ok($this, $type, $that, $name);
583 Works just like Test::More's cmp_ok().
585 $Test->cmp_ok($big_num, '!=', $other_big_num);
627 $Test->BAILOUT($reason);
629 Indicates to the Test::Harness that things are going so badly all
646 $Test->skip;
647 $Test->skip($why);
680 $Test->_print($out);
688 $Test->todo_skip;
689 $Test->todo_skip($why);
726 $Test->_print($out);
736 $Test->skip_rest;
737 $Test->skip_rest($reason);
750 =head2 Test style
756 $Test->level($how_high);
758 How far up the call stack should $Test look when reporting where the
763 Setting $Test::Builder::Level overrides. This is typically useful
767 local $Test::Builder::Level = 2;
768 $Test->ok($test);
787 $Test->use_numbers($on_or_off);
804 Test::Harness will accept either, but avoid mixing the two styles.
822 $Test->no_header($no_header);
828 $Test->no_ending($no_ending);
830 Normally, Test::Builder does some extra diagnostics when the test
831 ends. It also changes the exit code as described in Test::Simple.
864 Test::Builder's default output settings will not be affected.
870 $Test->diag(@msgs);
919 $Test->_print(@msgs);
938 # confuse Test::Harness.
951 $Test->output($fh);
952 $Test->output($file);
960 $Test->failure_output($fh);
961 $Test->failure_output($file);
969 $Test->todo_output($fh);
970 $Test->todo_output($file);
1051 =head2 Test Status and Info
1057 my $curr_test = $Test->current_test;
1058 $Test->current_test($num);
1098 my @tests = $Test->summary;
1115 my @tests = $Test->details;
1127 'ok' is true if Test::Harness will consider the test to be a pass.
1143 Sometimes the Test::Builder test counter is incremented without it
1145 In these cases, Test::Builder doesn't know the result of the test, so
1168 my $todo_reason = $Test->todo;
1169 my $todo_reason = $Test->todo($pack);
1172 will be considered 'todo' (see Test::More and Test::Harness for
1198 my $package = $Test->caller;
1199 my($pack, $file, $line) = $Test->caller;
1200 my($pack, $file, $line) = $Test->caller($height);
1307 # "require Test::Simple" doesn't puke.
1373 $Test->_ending if defined $Test and !$Test->no_ending;
1378 In perl 5.8.0 and later, Test::Builder is thread-safe. The test
1384 CPAN can provide the best examples. Test::Simple, Test::More,
1385 Test::Exception and Test::Differences all use Test::Builder.
1389 Test::Simple, Test::More, Test::Harness