File: warnings.t

package info (click to toggle)
libsignatures-perl 0.06-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 380 kB
  • sloc: perl: 1,235; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 522 bytes parent folder | download | duplicates (7)
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
use strict;
use warnings;
use Test::More tests => 4;

use vars qw/@warnings/;

BEGIN { $SIG{__WARN__} = sub { push @warnings, $_ } }

{
    use signatures;
    sub foo ($x) { }
}

BEGIN { is(@warnings, 0, 'no prototype warnings with signatures in scope') }

sub bar ($x) { }

BEGIN { is(@warnings, 1, 'warning without signatures in scope') }

use signatures;

sub baz ($x) { }

BEGIN { is(@warnings, 1, 'no more warnings') }

no signatures;

sub corge ($x) { }

BEGIN { is(@warnings, 2, 'disabling magic with unimport') }