~ubuntu-branches/ubuntu/natty/libsignatures-perl/natty

« back to all changes in this revision

Viewing changes to t/warnings.t

  • Committer: Bazaar Package Importer
  • Author(s): Ryan Niebur
  • Date: 2009-05-18 20:34:44 UTC
  • Revision ID: james.westby@ubuntu.com-20090518203444-ee3iqibpk6uxo7u8
Tags: upstream-0.05
ImportĀ upstreamĀ versionĀ 0.05

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use strict;
 
2
use warnings;
 
3
use Test::More tests => 4;
 
4
 
 
5
use vars qw/@warnings/;
 
6
 
 
7
BEGIN { $SIG{__WARN__} = sub { push @warnings, $_ } }
 
8
 
 
9
{
 
10
    use signatures;
 
11
    sub foo ($x) { }
 
12
}
 
13
 
 
14
BEGIN { is(@warnings, 0, 'no prototype warnings with signatures in scope') }
 
15
 
 
16
sub bar ($x) { }
 
17
 
 
18
BEGIN { is(@warnings, 1, 'warning without signatures in scope') }
 
19
 
 
20
use signatures;
 
21
 
 
22
sub baz ($x) { }
 
23
 
 
24
BEGIN { is(@warnings, 1, 'no more warnings') }
 
25
 
 
26
no signatures;
 
27
 
 
28
sub corge ($x) { }
 
29
 
 
30
BEGIN { is(@warnings, 2, 'disabling magic with unimport') }