File: 02-done_testing.t

package info (click to toggle)
libtest-warnings-perl 0.016-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 352 kB
  • ctags: 8
  • sloc: perl: 339; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 778 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use strict;
use warnings FATAL => 'all';

use Test::More 0.88;
use Test::Warnings;

# testing our alteration of done_testing is a bit tricky, as (duh) once we've
# called done_testing, we're done and cannot emit any further TAP.  Therefore,
# I'll do post-done_testing tests simply by diagnostics and via the exit code,
# which should be enough for cpantesters to generate a failure report.

pass('a passing test');

my $tb = Test::Builder->new;

is($tb->current_test, 1, 'we have had one test so far');

# now our test count is 2

done_testing;

# now our test count should be 3, and we cannot call any more test functions

my $tests = $tb->current_test;
if ($tests != 3)
{
    note 'test count not ok - is ' . $tests . ', should be 3!';
    exit 1;
}

note 'test count ok!';