Commit | Line | Data |
---|---|---|
599cee73 PM |
1 | pp.c TODO |
2 | ||
3 | substr outside of string | |
e476b1b5 | 4 | $a = "ab" ; $b = substr($a, 4,5) ; |
599cee73 PM |
5 | |
6 | Attempt to use reference as lvalue in substr | |
7 | $a = "ab" ; $b = \$a ; substr($b, 1,1) = $b | |
8 | ||
3b434eb1 | 9 | Use of uninitialized value in scalar dereference [pp_rv2sv()] |
599cee73 PM |
10 | my $a = undef ; my $b = $$a |
11 | ||
12 | Odd number of elements in hash list | |
13 | my $a = { 1,2,3 } ; | |
14 | ||
599cee73 PM |
15 | Explicit blessing to '' (assuming package main) |
16 | bless \[], ""; | |
17 | ||
3b434eb1 RGS |
18 | Constant subroutine %s undefined |
19 | sub foo () { 1 }; undef &foo; | |
20 | ||
21 | Constant subroutine (anonymous) undefined | |
22 | $foo = sub () { 3 }; undef &$foo; | |
0453d815 | 23 | |
599cee73 PM |
24 | __END__ |
25 | # pp.c | |
4438c4b7 | 26 | use warnings 'substr' ; |
599cee73 | 27 | $a = "ab" ; |
e476b1b5 | 28 | $b = substr($a, 4,5) ; |
4438c4b7 | 29 | no warnings 'substr' ; |
0453d815 | 30 | $a = "ab" ; |
e476b1b5 | 31 | $b = substr($a, 4,5) ; |
599cee73 PM |
32 | EXPECT |
33 | substr outside of string at - line 4. | |
34 | ######## | |
35 | # pp.c | |
4438c4b7 | 36 | use warnings 'substr' ; |
599cee73 PM |
37 | $a = "ab" ; |
38 | $b = \$a ; | |
39 | substr($b, 1,1) = "ab" ; | |
4438c4b7 | 40 | no warnings 'substr' ; |
0453d815 | 41 | substr($b, 1,1) = "ab" ; |
599cee73 PM |
42 | EXPECT |
43 | Attempt to use reference as lvalue in substr at - line 5. | |
44 | ######## | |
45 | # pp.c | |
5cd408a2 EB |
46 | use warnings 'misc' ; |
47 | @a = qw( a b c ); | |
48 | splice(@a, 4, 0, 'e') ; | |
49 | @a = qw( a b c ); | |
50 | splice(@a, 4, 1) ; | |
51 | @a = qw( a b c ); | |
52 | splice(@a, 4) ; | |
53 | no warnings 'misc' ; | |
54 | @a = qw( a b c ); | |
55 | splice(@a, 4, 0, 'e') ; | |
56 | @a = qw( a b c ); | |
57 | splice(@a, 4, 1) ; | |
58 | @a = qw( a b c ); | |
59 | splice(@a, 4) ; | |
60 | EXPECT | |
61 | splice() offset past end of array at - line 4. | |
62 | splice() offset past end of array at - line 6. | |
63 | ######## | |
64 | # pp.c | |
3b434eb1 RGS |
65 | use warnings 'uninitialized'; |
66 | $x = undef; $y = $$x; | |
67 | no warnings 'uninitialized' ; | |
68 | $u = undef; $v = $$u; | |
69 | EXPECT | |
29489e7c | 70 | Use of uninitialized value $x in scalar dereference at - line 3. |
599cee73 PM |
71 | ######## |
72 | # pp.c | |
e476b1b5 | 73 | use warnings 'misc' ; |
599cee73 | 74 | my $a = { 1,2,3}; |
e476b1b5 | 75 | no warnings 'misc' ; |
0453d815 | 76 | my $b = { 1,2,3}; |
599cee73 | 77 | EXPECT |
b21befc1 | 78 | Odd number of elements in anonymous hash at - line 3. |
599cee73 | 79 | ######## |
599cee73 | 80 | # pp.c |
e476b1b5 | 81 | use warnings 'misc' ; |
599cee73 | 82 | bless \[], "" ; |
e476b1b5 | 83 | no warnings 'misc' ; |
0453d815 | 84 | bless \[], "" ; |
599cee73 PM |
85 | EXPECT |
86 | Explicit blessing to '' (assuming package main) at - line 3. | |
0453d815 PM |
87 | ######## |
88 | # pp.c | |
3b434eb1 RGS |
89 | use warnings 'misc'; |
90 | sub foo () { 1 } | |
91 | undef &foo; | |
92 | no warnings 'misc'; | |
93 | sub bar () { 2 } | |
94 | undef &bar; | |
95 | EXPECT | |
96 | Constant subroutine foo undefined at - line 4. | |
97 | ######## | |
98 | # pp.c | |
714cd18f BF |
99 | use utf8; |
100 | use open qw( :utf8 :std ); | |
101 | use warnings 'misc'; | |
102 | sub ฝᶱ () { 1 } | |
103 | undef &ฝᶱ; | |
104 | no warnings 'misc'; | |
105 | sub ƚ () { 2 } | |
106 | undef &ƚ; | |
107 | EXPECT | |
108 | Constant subroutine ฝᶱ undefined at - line 6. | |
109 | ######## | |
110 | # pp.c | |
3b434eb1 RGS |
111 | use warnings 'misc'; |
112 | $foo = sub () { 3 }; | |
113 | undef &$foo; | |
114 | no warnings 'misc'; | |
115 | $bar = sub () { 4 }; | |
116 | undef &$bar; | |
117 | EXPECT | |
118 | Constant subroutine (anonymous) undefined at - line 4. | |
119 | ######## | |
120 | # pp.c | |
0453d815 PM |
121 | use utf8 ; |
122 | $_ = "\x80 \xff" ; | |
123 | reverse ; | |
124 | EXPECT |