This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Deprecate wide chars in logical string ops
[perl5.git] / t / lib / warnings / 6default
CommitLineData
0453d815
PM
1Check default warnings
2
3__END__
4438c4b7 4# default warnings should be displayed if you don't add anything
0453d815
PM
5# optional shouldn't
6my $a = oct "7777777777777777777777777777777777779" ;
7EXPECT
8Integer overflow in octal number at - line 3.
9########
4438c4b7
JH
10# no warnings should be displayed
11no warnings ;
9e24b6e2 12my $a = oct "7777777777777777777777777777777777778" ;
0453d815
PM
13EXPECT
14########
4438c4b7
JH
15# all warnings should be displayed
16use warnings ;
9e24b6e2 17my $a = oct "7777777777777777777777777777777777778" ;
0453d815 18EXPECT
9e24b6e2
JH
19Integer overflow in octal number at - line 3.
20Illegal octal digit '8' ignored at - line 3.
21Octal number > 037777777777 non-portable at - line 3.
0453d815
PM
22########
23# check scope
4438c4b7 24use warnings ;
9e24b6e2 25my $a = oct "7777777777777777777777777777777777778" ;
0453d815 26{
4438c4b7 27 no warnings ;
9e24b6e2 28 my $a = oct "7777777777777777777777777777777777778" ;
0453d815 29}
9e24b6e2 30my $c = oct "7777777777777777777777777777777777778" ;
0453d815 31EXPECT
9e24b6e2
JH
32Integer overflow in octal number at - line 3.
33Illegal octal digit '8' ignored at - line 3.
34Octal number > 037777777777 non-portable at - line 3.
0453d815 35Integer overflow in octal number at - line 8.
9e24b6e2
JH
36Illegal octal digit '8' ignored at - line 8.
37Octal number > 037777777777 non-portable at - line 8.
38########
4438c4b7
JH
39# all warnings should be displayed
40use warnings ;
9e24b6e2
JH
41my $a = oct "0xfffffffffffffffffg" ;
42EXPECT
43Integer overflow in hexadecimal number at - line 3.
44Illegal hexadecimal digit 'g' ignored at - line 3.
45Hexadecimal number > 0xffffffff non-portable at - line 3.
46########
4438c4b7
JH
47# all warnings should be displayed
48use warnings ;
9e24b6e2
JH
49my $a = oct "0b111111111111111111111111111111111111111111111111111111111111111112";
50EXPECT
51Integer overflow in binary number at - line 3.
52Illegal binary digit '2' ignored at - line 3.
53Binary number > 0b11111111111111111111111111111111 non-portable at - line 3.
16ff4256
GS
54########
55
56# Check scope of pragma with eval
57use warnings;
58{
59 no warnings ;
60 eval '
61 my $a = oct "0xfffffffffffffffffg" ;
62 '; print STDERR $@ ;
63 my $a = oct "0xfffffffffffffffffg" ;
64}
65EXPECT
66
67########
68
69# Check scope of pragma with eval
70use warnings;
71{
72 no warnings ;
73 eval q[
74 use warnings ;
75 my $a = oct "0xfffffffffffffffffg" ;
76 ]; print STDERR $@;
77 my $a = oct "0xfffffffffffffffffg" ;
78}
79EXPECT
80Integer overflow in hexadecimal number at (eval 1) line 3.
81Illegal hexadecimal digit 'g' ignored at (eval 1) line 3.
82Hexadecimal number > 0xffffffff non-portable at (eval 1) line 3.
83########
84
85# Check scope of pragma with eval
86no warnings;
87{
88 use warnings ;
89 eval '
90 my $a = oct "0xfffffffffffffffffg" ;
91 '; print STDERR $@ ;
92}
93EXPECT
94Integer overflow in hexadecimal number at (eval 1) line 2.
95Illegal hexadecimal digit 'g' ignored at (eval 1) line 2.
96Hexadecimal number > 0xffffffff non-portable at (eval 1) line 2.
97########
98
99# Check scope of pragma with eval
100no warnings;
101{
102 use warnings;
103 eval '
104 no warnings ;
105 my $a = oct "0xfffffffffffffffffg" ;
106 '; print STDERR $@ ;
107}
108EXPECT
109
110########
111
112# Check scope of pragma with eval
113no warnings;
114{
115 use warnings 'deprecated' ;
116 eval '
117 my $a = oct "0xfffffffffffffffffg" ;
118 '; print STDERR $@;
119}
120EXPECT
121