Tidy up comments.
[p5sagit/p5-mst-13.2.git] / ext / MIME-Base64 / t / warn.t
CommitLineData
0a362e9d 1#!perl -w
2
3BEGIN {
4 if ($ENV{'PERL_CORE'}){
5 chdir 't' if -d 't';
6 @INC = '../lib';
7 }
8}
9
10BEGIN {
11 eval {
12 require warnings;
13 };
14 if ($@) {
15 print "1..0\n";
16 print $@;
17 exit;
18 }
19}
20
21use strict;
22use MIME::Base64 qw(decode_base64);
23
24print "1..1\n";
25
26use warnings;
27
28my @warn;
29$SIG{__WARN__} = sub { push(@warn, @_) };
30
31warn;
32my $a;
33$a = decode_base64("aa");
34$a = decode_base64("a===");
35warn;
36$a = do {
37 no warnings;
38 decode_base64("aa");
39};
40$a = do {
41 no warnings;
42 decode_base64("a===");
43};
44warn;
45$a = do {
46 local $^W;
47 decode_base64("aa");
48};
49$a = do {
50 local $^W;
51 decode_base64("a===");
52};
53warn;
54
0a362e9d 55for (@warn) {
56 print "# $_";
57}
58
59print "not " unless join("", @warn) eq <<"EOT"; print "ok 1\n";
60Warning: something's wrong at $0 line 31.
61Premature end of base64 data at $0 line 33.
62Premature padding of base64 data at $0 line 34.
63Warning: something's wrong at $0 line 35.
64Premature end of base64 data at $0 line 38.
65Premature padding of base64 data at $0 line 42.
66Warning: something's wrong at $0 line 44.
67Warning: something's wrong at $0 line 53.
68EOT