File: README

package info (click to toggle)
libtest-warn-perl 0.37-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 128 kB
  • sloc: perl: 662; makefile: 2
file content (79 lines) | stat: -rw-r--r-- 2,191 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Test/Warn version 0.37
======================

INSTALLATION

To install this module type the following:
   cpan Test::Warn

or

   perl Makefile.PL
   make
   make test
   make install

DEPENDENCIES

This module requires these other modules and libraries:

Test::Builder
Sub::Uplevel
File::Spec

SYNOPSIS

      use Test::Warn;

      warning_is    {foo(-dri => "/")} "Unknown Parameter 'dri'", "dri != dir gives warning";
      warnings_are  {bar(1,1)} ["Width very small", "Height very small"];

      warning_is    {add(2,2)} undef, "No warning to calc 2+2"; # or
      warnings_are  {add(2,2)} [],    "No warning to calc 2+2"; # what reads better :-)

      warning_like  {foo(-dri => "/"} qr/unknown param/i, "an unknown parameter test";
      warnings_like {bar(1,1)} [qr/width.*small/i, qr/height.*small/i];

      warning_is    {foo()} {carped => 'didn't found the right parameters'};
      warnings_like {foo()} [qr/undefined/,qr/undefined/,{carped => qr/no result/i}];

      warning_like {foo(undef)}                 'uninitialized';
      warning_like {bar(file => '/etc/passwd')} 'io';

      warning_like {eval q/"$x"; $x;/}
                   [qw/void uninitialized/],
                   "some warnings at compile time";

DESCRIPTION

    This module provides a few convenience methods for testing warning based
    code.

    If you are not already familiar with the Test::More manpage now would be
    the time to go take a look.

  FUNCTIONS - OVERVIEW
    warning_is    BLOCK STRING,   TEST_NAME
    warnings_are  BLOCK ARRAYREF, TEST_NAME
    warning_like  BLOCK REGEXP,   TEST_NAME
    warning_like  BLOCK STRING,   TEST_NAME
    warnings_like BLOCK ARRAYREF, TEST_NAME

SEE ALSO
    Have a look to the similar Test::Exception module.

THANKS
    Many thanks to Adrian Howard, chromatic and Michael G. Schwern, who have
    given me a lot of ideas.

AUTHOR
    Janek Schleicher, <bigj@kamelfreund.de>

COPYRIGHT AND LICENSE
    Copyright 2002 by Janek Schleicher
    Copyright 2007-2016 by Alexandr Ciornii
    Copyright 2016-2018 by Janek Schleicher

    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.