summaryrefslogtreecommitdiffstats
path: root/contrib/perl5/t/pragma/warn/4lint
blob: db54f31c7b4cdfda594506d4f0cfbd9f6d9f4383 (plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
Check lint

__END__
-W
# lint: check compile time $^W is zapped
BEGIN { $^W = 0 ;}
$a = $b = 1 ;
$a = 1 if $a EQ $b ;
close STDIN ; print STDIN "abc" ;
EXPECT
Use of EQ is deprecated at - line 5.
print() on closed filehandle main::STDIN at - line 6.
########
-W
# lint: check runtime $^W is zapped
$^W = 0 ;
close STDIN ; print STDIN "abc" ;
EXPECT
print() on closed filehandle main::STDIN at - line 4.
########
-W
# lint: check runtime $^W is zapped
{
  $^W = 0 ;
  close STDIN ; print STDIN "abc" ;
}
EXPECT
print() on closed filehandle main::STDIN at - line 5.
########
-W
# lint: check "no warnings" is zapped
no warnings ;
$a = $b = 1 ;
$a = 1 if $a EQ $b ;
close STDIN ; print STDIN "abc" ;
EXPECT
Use of EQ is deprecated at - line 5.
print() on closed filehandle main::STDIN at - line 6.
########
-W
# lint: check "no warnings" is zapped
{
  no warnings ;
  close STDIN ; print STDIN "abc" ;
}
EXPECT
print() on closed filehandle main::STDIN at - line 5.
########
-Ww
# lint: check combination of -w and -W
{
  $^W = 0 ;
  close STDIN ; print STDIN "abc" ;
}
EXPECT
print() on closed filehandle main::STDIN at - line 5.
########
-W
--FILE-- abc.pm
no warnings 'deprecated' ;
my ($a, $b) = (0,0);
1 if $a EQ $b ;
1;
--FILE-- 
no warnings 'uninitialized' ;
use abc;
my $a ; chop $a ;
EXPECT
Use of EQ is deprecated at abc.pm line 3.
Use of uninitialized value in scalar chop at - line 3.
########
-W
--FILE-- abc
no warnings 'deprecated' ;
my ($a, $b) = (0,0);
1 if $a EQ $b ;
1;
--FILE-- 
no warnings 'uninitialized' ;
require "./abc";
my $a ; chop $a ;
EXPECT
Use of EQ is deprecated at ./abc line 3.
Use of uninitialized value in scalar chop at - line 3.
########
-W
--FILE-- abc.pm
BEGIN {$^W = 0}
my ($a, $b) = (0,0);
1 if $a EQ $b ;
1;
--FILE-- 
$^W = 0 ;
use abc;
my $a ; chop $a ;
EXPECT
Use of EQ is deprecated at abc.pm line 3.
Use of uninitialized value in scalar chop at - line 3.
########
-W
--FILE-- abc
BEGIN {$^W = 0}
my ($a, $b) = (0,0);
1 if $a EQ $b ;
1;
--FILE-- 
$^W = 0 ;
require "./abc";
my $a ; chop $a ;
EXPECT
Use of EQ is deprecated at ./abc line 3.
Use of uninitialized value in scalar chop at - line 3.
OpenPOWER on IntegriCloud