File: with_done_testing.t

package info (click to toggle)
libtest-warnings-perl 0.038-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 472 kB
  • sloc: perl: 375; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 695 bytes parent folder | download | duplicates (4)
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
use strict;
use warnings;

# another demonstration of the various features of Test::Warnings, where
# Test::More::done_testing is used

use Test::More;
use Test::Warnings ':all';

is(1, 1, 'passing test');

had_no_warnings;

ok(!allowing_warnings, 'warnings are not currently allowed');

allow_warnings;
ok(allowing_warnings, 'warnings are now allowed');

warn 'this warning will not cause a failure';
had_no_warnings;

allow_warnings(0);
ok(!allowing_warnings, 'warnings are not allowed again');
warn 'oh noes, something warned!';

# this will now fail.
had_no_warnings;

note 'we are done; call done_testing to signal completion. had_no_warnings will be called automatically.';

done_testing;