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