3 # Tests too complex for t/base/lex.t
8 BEGIN { chdir 't' if -d 't'; require './test.pl'; }
13 no warnings 'deprecated';
17 # previous line intentionally left blank.
23 # previous line intentionally left blank.
30 my %foo = (aap => "monkey");
32 is("@{[$foo{'aap'}]}", 'monkey', 'interpolation of hash lookup with space between lexical variable and subscript');
33 is("@{[$foo {'aap'}]}", 'monkey', 'interpolation of hash lookup with space between lexical variable and subscript - test for [perl #70091]');
35 # Original bug report [perl #70091]
40 # (my $tmp = $foo) =~ s/^/$foo {$0}/e;
43 # This program causes a segfault with 5.10.0 and 5.10.1.
45 # The space between '$foo' and '{' is essential, which is why piping
46 # it through perl -MO=Deparse "fixes" it.
52 delete local $ENV{PERL_UNICODE};
54 'BEGIN{ ++$_ for @INC{"charnames.pm","_charnames.pm"} } "\N{a}"',
55 'Constant(\N{a}) unknown at - line 1, within string' . "\n"
56 ."Execution of - aborted due to compilation errors.\n",
58 'correct output (and no crash) when charnames cannot load for \N{...}'
62 'BEGIN{ ++$_ for @INC{"charnames.pm","_charnames.pm"};
63 $^H{charnames} = "foo" } "\N{a}"',
64 "Undefined subroutine &main::foo called at - line 2.\n"
65 ."Propagated at - line 2, within string\n"
66 ."Execution of - aborted due to compilation errors.\n",
68 'no crash when charnames cannot load and %^H holds string'
71 'BEGIN{ ++$_ for @INC{"charnames.pm","_charnames.pm"};
72 $^H{charnames} = \"foo" } "\N{a}"',
73 "Not a CODE reference at - line 2.\n"
74 ."Propagated at - line 2, within string\n"
75 ."Execution of - aborted due to compilation errors.\n",
77 'no crash when charnames cannot load and %^H holds string reference'
80 # not fresh_perl_is, as it seems to hide the error
82 nolib => 1, # -Ilib may also hide the error
85 ' XS::APItest::gv_fetchmeth_type()',
90 "Undefined subroutine &XS::APItest::gv_fetchmeth_type called at -e line "
92 'no buffer corruption with multiline *{...expr...}'
96 is ${no strict; \$_}, "rhubarb", '${no strict; ...}';
97 is join("", map{no strict; "rhu$_" } "barb"), 'rhubarb',
102 '$eq = "ok\n"; print $' . "\0eq\n",
108 '@eq = "ok\n"; print @' . "\0eq\n",
114 '%eq = ("o"=>"k\n"); print %' . "\0eq\n",
120 'sub eq { "ok\n" } print &' . "\0eq\n",
126 '$eq = "ok\n"; print ${*' . "\0eq{SCALAR}}\n",
132 skip "Different output on EBCDIC (presumably)", 2 if ord("A") != 65;
134 qq'"ab}"ax;&\0z\x8Ao}\x82x;', <<gibberish,
135 Bareword found where operator expected at - line 1, near ""ab}"ax"
136 (Missing operator before ax?)
137 syntax error at - line 1, near ""ab}"ax"
138 Unrecognized character \\x8A; marked by <-- HERE after ab}"ax;&\0z<-- HERE near column 12 at - line 1.
141 'gibberish containing &\0z - used to crash [perl #123753]'
144 qq'"ab}"ax;&{+z}\x8Ao}\x82x;', <<gibberish,
145 Bareword found where operator expected at - line 1, near ""ab}"ax"
146 (Missing operator before ax?)
147 syntax error at - line 1, near ""ab}"ax"
148 Unrecognized character \\x8A; marked by <-- HERE after }"ax;&{+z}<-- HERE near column 14 at - line 1.
151 'gibberish containing &{+z} - used to crash [perl #123753]'
157 "Missing right curly or square bracket at - line 1, within pattern\n" .
158 "syntax error at - line 1, at EOF\n" .
159 "Execution of - aborted due to compilation errors.\n",
161 '/$a[/<<a with no newline [perl #123712]'
165 "Missing right curly or square bracket at - line 1, within pattern\n" .
166 "syntax error at - line 1, at EOF\n" .
167 "Execution of - aborted due to compilation errors.\n",
169 '/$a[m||/<<a with no newline [perl #123712]'
174 "Missing right curly or square bracket at - line 1, within string\n" .
175 "syntax error at - line 1, at EOF\n" .
176 "Execution of - aborted due to compilation errors.\n",
178 '"@{" [perl #123712]'
183 'syntax error at - line 1, near "{}"' . "\n" .
184 "Execution of - aborted due to compilation errors.\n",
186 '/$0{}/ with no newline [perl #123802]'
190 'syntax error at - line 1, near "\L\L"' . "\n" .
191 "Execution of - aborted due to compilation errors.\n",
193 '"\L\L" with no newline [perl #123802]'
197 'syntax error at - line 1, near "\L\L"' . "\n" .
198 "Execution of - aborted due to compilation errors.\n",
200 '<\L\L> with no newline [perl #123802]'
203 is eval "qq'@\x{ff13}'", "\@\x{ff13}",
204 '"@<fullwidth digit>" [perl #123963]';
208 "Can't find string terminator \"a\" anywhere before EOF at - line 1.\n",
210 's;@{<<a; [perl #123995]'