3 # Tests too complex for t/base/lex.t
8 BEGIN { chdir 't' if -d 't'; require './test.pl'; }
16 # previous line intentionally left blank.
22 # previous line intentionally left blank.
29 my %foo = (aap => "monkey");
31 is("@{[$foo{'aap'}]}", 'monkey', 'interpolation of hash lookup with space between lexical variable and subscript');
32 is("@{[$foo {'aap'}]}", 'monkey', 'interpolation of hash lookup with space between lexical variable and subscript - test for [perl #70091]');
34 # Original bug report [perl #70091]
39 # (my $tmp = $foo) =~ s/^/$foo {$0}/e;
42 # This program causes a segfault with 5.10.0 and 5.10.1.
44 # The space between '$foo' and '{' is essential, which is why piping
45 # it through perl -MO=Deparse "fixes" it.
51 delete local $ENV{PERL_UNICODE};
53 'BEGIN{ ++$_ for @INC{"charnames.pm","_charnames.pm"} } "\N{a}"',
54 'Constant(\N{a}) unknown at - line 1, within string' . "\n"
55 ."Execution of - aborted due to compilation errors.\n",
57 'correct output (and no crash) when charnames cannot load for \N{...}'
61 'BEGIN{ ++$_ for @INC{"charnames.pm","_charnames.pm"};
62 $^H{charnames} = "foo" } "\N{a}"',
63 "Undefined subroutine &main::foo called at - line 2.\n"
64 ."Propagated at - line 2, within string\n"
65 ."Execution of - aborted due to compilation errors.\n",
67 'no crash when charnames cannot load and %^H holds string'
70 'BEGIN{ ++$_ for @INC{"charnames.pm","_charnames.pm"};
71 $^H{charnames} = \"foo" } "\N{a}"',
72 "Not a CODE reference at - line 2.\n"
73 ."Propagated at - line 2, within string\n"
74 ."Execution of - aborted due to compilation errors.\n",
76 'no crash when charnames cannot load and %^H holds string reference'
79 # not fresh_perl_is, as it seems to hide the error
81 nolib => 1, # -Ilib may also hide the error
84 ' XS::APItest::gv_fetchmeth_type()',
89 "Undefined subroutine &XS::APItest::gv_fetchmeth_type called at -e line "
91 'no buffer corruption with multiline *{...expr...}'
95 is ${no strict; \$_}, "rhubarb", '${no strict; ...}';
96 is join("", map{no strict; "rhu$_" } "barb"), 'rhubarb',
101 '$eq = "ok\n"; print $' . "\0eq\n",
107 '@eq = "ok\n"; print @' . "\0eq\n",
113 '%eq = ("o"=>"k\n"); print %' . "\0eq\n",
119 'sub eq { "ok\n" } print &' . "\0eq\n",
125 '$eq = "ok\n"; print ${*' . "\0eq{SCALAR}}\n",
131 skip "Different output on EBCDIC (presumably)", 3 if $::IS_EBCDIC;
133 qq'"ab}"ax;&\0z\x8Ao}\x82x;', <<gibberish,
134 Bareword found where operator expected at - line 1, near ""ab}"ax"
135 (Missing operator before ax?)
136 syntax error at - line 1, near ""ab}"ax"
137 Unrecognized character \\x8A; marked by <-- HERE after ab}"ax;&\0z<-- HERE near column 12 at - line 1.
140 'gibberish containing &\0z - used to crash [perl #123753]'
143 qq'"ab}"ax;&{+z}\x8Ao}\x82x;', <<gibberish,
144 Bareword found where operator expected at - line 1, near ""ab}"ax"
145 (Missing operator before ax?)
146 syntax error at - line 1, near ""ab}"ax"
147 Unrecognized character \\x8A; marked by <-- HERE after }"ax;&{+z}<-- HERE near column 14 at - line 1.
150 'gibberish containing &{+z} - used to crash [perl #123753]'
153 "\@{\327\n", <<\gibberisi,
154 Unrecognized character \xD7; marked by <-- HERE after @{<-- HERE near column 3 at - line 1.
157 '@ { \327 \n - used to garble output (or fail asan) [perl #128951]'
163 "Missing right curly or square bracket at - line 1, within pattern\n" .
164 "syntax error at - line 1, at EOF\n" .
165 "Execution of - aborted due to compilation errors.\n",
167 '/$a[/<<a with no newline [perl #123712]'
171 "Missing right curly or square bracket at - line 1, within pattern\n" .
172 "syntax error at - line 1, at EOF\n" .
173 "Execution of - aborted due to compilation errors.\n",
175 '/$a[m||/<<a with no newline [perl #123712]'
180 "Missing right curly or square bracket at - line 1, within string\n" .
181 "syntax error at - line 1, at EOF\n" .
182 "Execution of - aborted due to compilation errors.\n",
184 '"@{" [perl #123712]'
189 'syntax error at - line 1, near "{}"' . "\n" .
190 "Execution of - aborted due to compilation errors.\n",
192 '/$0{}/ with no newline [perl #123802]'
196 'syntax error at - line 1, near "\L\L"' . "\n" .
197 "Execution of - aborted due to compilation errors.\n",
199 '"\L\L" with no newline [perl #123802]'
203 'syntax error at - line 1, near "\L\L"' . "\n" .
204 "Execution of - aborted due to compilation errors.\n",
206 '<\L\L> with no newline [perl #123802]'
209 is eval "qq'@\x{ff13}'", "\@\x{ff13}",
210 '"@<fullwidth digit>" [perl #123963]';
214 "Can't find string terminator \"a\" anywhere before EOF at - line 1.\n",
216 's;@{<<a; [perl #123995]'
220 '$_ = q-strict.pm-; 1 ? require : die;'
221 .' print qq-ok\n- if $INC{q-strict.pm-}',
224 'foo ? require : bar [perl #128307]'
227 like runperl(prog => 'sub ub(){0} ub ub', stderr=>1), qr/Bareword found/,
228 '[perl #126482] Assert failure when mentioning a constant twice in a row';
234 '[perl #129069] - no output and valgrind clean'
239 "Missing name in \"my sub\" at - line 1.\n",
241 '[perl #129069] - "Missing name" warning and valgrind clean'
245 "#!perl -i u\nprint 'OK'",
248 '[perl #129336] - #!perl -i argument handling'
253 or skip "These tests won't work on EBCIDIC", 3;
255 "BEGIN{\$^H=hex ~0}\xF3",
256 "Integer overflow in hexadecimal number at - line 1.\n"
257 . "Malformed UTF-8 character: \\xf3 (too short; 1 byte available, need 4) at - line 1.\n"
258 . "Malformed UTF-8 character (fatal) at - line 1.",
260 '[perl #128996] - use of PL_op after op is freed'
263 qq(BEGIN{\$0="";\$^H=-hex join""=>1}""\xFF),
264 qr/Malformed UTF-8 character: \\xff \(too short; 1 byte available, need 13\) at - line 1\./,
266 '[perl #128997] - buffer read overflow'
269 qq(BEGIN{\$^H=0x800000}\n 0m 0\xB5\xB500\xB5\0),
270 qr/Malformed UTF-8 character: \\xb5 \(unexpected continuation byte 0xb5, with no preceding start byte\)/,
272 '[perl #129000] read before buffer'
275 # probably only failed under ASAN
279 $# is no longer supported. Its use will be fatal in Perl 5.30 at - line 1.
280 Number found where operator expected at - line 1, near "$#0"
281 (Missing operator before 0?)
282 Can't call method "t" on an undefined value at - line 1.
285 "[perl #129273] heap use after free or overflow"
288 fresh_perl_like('flock _$', qr/Not enough arguments for flock/, {stderr => 1},
289 "[perl #129190] intuit_method() invalidates PL_bufptr");