Debian Codegraph @

README

raw
1 Test/Warn version 0.37
2 ======================
3
4 INSTALLATION
5
6 To install this module type the following:
7 cpan Test::Warn
8
9 or
10
11 perl Makefile.PL
12 make
13 make test
14 make install
15
16 DEPENDENCIES
17
18 This module requires these other modules and libraries:
19
20 Test::Builder
21 Sub::Uplevel
22 File::Spec
23
24 SYNOPSIS
25
26 use Test::Warn;
27
28 warning_is {foo(-dri => "/")} "Unknown Parameter 'dri'", "dri != dir gives warning";
29 warnings_are {bar(1,1)} ["Width very small", "Height very small"];
30
31 warning_is {add(2,2)} undef, "No warning to calc 2+2"; # or
32 warnings_are {add(2,2)} [], "No warning to calc 2+2"; # what reads better :-)
33
34 warning_like {foo(-dri => "/"} qr/unknown param/i, "an unknown parameter test";
35 warnings_like {bar(1,1)} [qr/width.*small/i, qr/height.*small/i];
36
37 warning_is {foo()} {carped => 'didn't found the right parameters'};
38 warnings_like {foo()} [qr/undefined/,qr/undefined/,{carped => qr/no result/i}];
39
40 warning_like {foo(undef)} 'uninitialized';
41 warning_like {bar(file => '/etc/passwd')} 'io';
42
43 warning_like {eval q/"$x"; $x;/}
44 [qw/void uninitialized/],
45 "some warnings at compile time";
46
47 DESCRIPTION
48
49 This module provides a few convenience methods for testing warning based
50 code.
51
52 If you are not already familiar with the Test::More manpage now would be
53 the time to go take a look.
54
55 FUNCTIONS - OVERVIEW
56 warning_is BLOCK STRING, TEST_NAME
57 warnings_are BLOCK ARRAYREF, TEST_NAME
58 warning_like BLOCK REGEXP, TEST_NAME
59 warning_like BLOCK STRING, TEST_NAME
60 warnings_like BLOCK ARRAYREF, TEST_NAME
61
62 SEE ALSO
63 Have a look to the similar Test::Exception module.
64
65 THANKS
66 Many thanks to Adrian Howard, chromatic and Michael G. Schwern, who have
67 given me a lot of ideas.
68
69 AUTHOR
70 Janek Schleicher, <[email protected]>
71
72 COPYRIGHT AND LICENSE
73 Copyright 2002 by Janek Schleicher
74 Copyright 2007-2016 by Alexandr Ciornii
75 Copyright 2016-2018 by Janek Schleicher
76
77 This library is free software; you can redistribute it and/or modify it
78 under the same terms as Perl itself.
79