Move the locale/strict/warnings helper files back
[p5sagit/p5-mst-13.2.git] / t / lib / warnings / pp
CommitLineData
599cee73 1 pp.c TODO
2
3 substr outside of string
e476b1b5 4 $a = "ab" ; $b = substr($a, 4,5) ;
599cee73 5
6 Attempt to use reference as lvalue in substr
7 $a = "ab" ; $b = \$a ; substr($b, 1,1) = $b
8
9 uninitialized in pp_rv2gv()
10 my *b = *{ undef()}
11
12 uninitialized in pp_rv2sv()
13 my $a = undef ; my $b = $$a
14
15 Odd number of elements in hash list
16 my $a = { 1,2,3 } ;
17
18 Invalid type in unpack: '%c
19 my $A = pack ("A,A", 1,2) ;
20 my @A = unpack ("A,A", "22") ;
21
22 Attempt to pack pointer to temporary value
23 pack("p", "abc") ;
24
25 Explicit blessing to '' (assuming package main)
26 bless \[], "";
27
0453d815 28 Constant subroutine %s undefined <<<TODO
29 Constant subroutine (anonymous) undefined <<<TODO
30
599cee73 31__END__
32# pp.c
4438c4b7 33use warnings 'substr' ;
599cee73 34$a = "ab" ;
e476b1b5 35$b = substr($a, 4,5) ;
4438c4b7 36no warnings 'substr' ;
0453d815 37$a = "ab" ;
e476b1b5 38$b = substr($a, 4,5) ;
599cee73 39EXPECT
40substr outside of string at - line 4.
41########
42# pp.c
4438c4b7 43use warnings 'substr' ;
599cee73 44$a = "ab" ;
45$b = \$a ;
46substr($b, 1,1) = "ab" ;
4438c4b7 47no warnings 'substr' ;
0453d815 48substr($b, 1,1) = "ab" ;
599cee73 49EXPECT
50Attempt to use reference as lvalue in substr at - line 5.
51########
52# pp.c
4438c4b7 53use warnings 'uninitialized' ;
599cee73 54# TODO
55EXPECT
56
57########
58# pp.c
e476b1b5 59use warnings 'misc' ;
599cee73 60my $a = { 1,2,3};
e476b1b5 61no warnings 'misc' ;
0453d815 62my $b = { 1,2,3};
599cee73 63EXPECT
64Odd number of elements in hash assignment at - line 3.
65########
66# pp.c
e476b1b5 67use warnings 'pack' ;
68use warnings 'unpack' ;
599cee73 69my @a = unpack ("A,A", "22") ;
70my $a = pack ("A,A", 1,2) ;
e476b1b5 71no warnings 'pack' ;
72no warnings 'unpack' ;
0453d815 73my @b = unpack ("A,A", "22") ;
74my $b = pack ("A,A", 1,2) ;
599cee73 75EXPECT
e476b1b5 76Invalid type in unpack: ',' at - line 4.
77Invalid type in pack: ',' at - line 5.
599cee73 78########
79# pp.c
4438c4b7 80use warnings 'uninitialized' ;
599cee73 81my $a = undef ;
0453d815 82my $b = $$a;
4438c4b7 83no warnings 'uninitialized' ;
0453d815 84my $c = $$a;
599cee73 85EXPECT
b89fed5f 86Use of uninitialized value in scalar dereference at - line 4.
599cee73 87########
88# pp.c
e476b1b5 89use warnings 'pack' ;
599cee73 90sub foo { my $a = "a"; return $a . $a++ . $a++ }
91my $a = pack("p", &foo) ;
e476b1b5 92no warnings 'pack' ;
0453d815 93my $b = pack("p", &foo) ;
599cee73 94EXPECT
95Attempt to pack pointer to temporary value at - line 4.
96########
97# pp.c
e476b1b5 98use warnings 'misc' ;
599cee73 99bless \[], "" ;
e476b1b5 100no warnings 'misc' ;
0453d815 101bless \[], "" ;
599cee73 102EXPECT
103Explicit blessing to '' (assuming package main) at - line 3.
0453d815 104########
105# pp.c
106use utf8 ;
107$_ = "\x80 \xff" ;
108reverse ;
109EXPECT
0453d815 110########
ac7cd81a 111# pp.c
112use warnings 'pack' ;
113print unpack("C", pack("C", -1)), "\n";
114print unpack("C", pack("C", 0)), "\n";
115print unpack("C", pack("C", 255)), "\n";
116print unpack("C", pack("C", 256)), "\n";
117print unpack("c", pack("c", -129)), "\n";
118print unpack("c", pack("c", -128)), "\n";
119print unpack("c", pack("c", 127)), "\n";
120print unpack("c", pack("c", 128)), "\n";
121no warnings 'pack' ;
122print unpack("C", pack("C", -1)), "\n";
123print unpack("C", pack("C", 0)), "\n";
124print unpack("C", pack("C", 255)), "\n";
125print unpack("C", pack("C", 256)), "\n";
126print unpack("c", pack("c", -129)), "\n";
127print unpack("c", pack("c", -128)), "\n";
128print unpack("c", pack("c", 127)), "\n";
129print unpack("c", pack("c", 128)), "\n";
130EXPECT
131Character in "C" format wrapped at - line 3.
132Character in "C" format wrapped at - line 6.
133Character in "c" format wrapped at - line 7.
134Character in "c" format wrapped at - line 10.
135255
1360
137255
1380
139127
140-128
141127
142-128
143255
1440
145255
1460
147127
148-128
149127
150-128