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
113
114
115
116
|
#!perl
use strict;
use warnings;
BEGIN { chdir 't'; require './test.pl'; }
plan(tests => 11);
{
no warnings 'deprecated';
print <<; # Yow!
ok 1
# previous line intentionally left blank.
my $yow = "ok 2";
print <<; # Yow!
$yow
# previous line intentionally left blank.
}
curr_test(3);
{
my %foo = (aap => "monkey");
my $foo = '';
is("@{[$foo{'aap'}]}", 'monkey', 'interpolation of hash lookup with space between lexical variable and subscript');
is("@{[$foo {'aap'}]}", 'monkey', 'interpolation of hash lookup with space between lexical variable and subscript - test for [perl #70091]');
# Original bug report [perl #70091]
# #!perl
# use warnings;
# my %foo;
# my $foo = '';
# (my $tmp = $foo) =~ s/^/$foo {$0}/e;
# __END__
#
# This program causes a segfault with 5.10.0 and 5.10.1.
#
# The space between '$foo' and '{' is essential, which is why piping
# it through perl -MO=Deparse "fixes" it.
#
}
{
delete local $ENV{PERL_UNICODE};
fresh_perl_is(
'BEGIN{ ++$_ for @INC{"charnames.pm","_charnames.pm"} } "\N{a}"',
'Constant(\N{a}) unknown at - line 1, within string' . "\n"
."Execution of - aborted due to compilation errors.\n",
{ stderr => 1 },
'correct output (and no crash) when charnames cannot load for \N{...}'
);
}
fresh_perl_is(
'BEGIN{ ++$_ for @INC{"charnames.pm","_charnames.pm"};
$^H{charnames} = "foo" } "\N{a}"',
"Undefined subroutine &main::foo called at - line 2.\n"
."Propagated at - line 2, within string\n"
."Execution of - aborted due to compilation errors.\n",
{ stderr => 1 },
'no crash when charnames cannot load and %^H holds string'
);
fresh_perl_is(
'BEGIN{ ++$_ for @INC{"charnames.pm","_charnames.pm"};
$^H{charnames} = \"foo" } "\N{a}"',
"Not a CODE reference at - line 2.\n"
."Propagated at - line 2, within string\n"
."Execution of - aborted due to compilation errors.\n",
{ stderr => 1 },
'no crash when charnames cannot load and %^H holds string reference'
);
# not fresh_perl_is, as it seems to hide the error
is runperl(
nolib => 1, # -Ilib may also hide the error
progs => [
'*{',
' XS::APItest::gv_fetchmeth_type()',
'}'
],
stderr => 1,
),
"Undefined subroutine &XS::APItest::gv_fetchmeth_type called at -e line "
."2.\n",
'no buffer corruption with multiline *{...expr...}'
;
fresh_perl_is(
'/$a[/<<a',
"Missing right curly or square bracket at - line 1, within pattern\n" .
"syntax error at - line 1, at EOF\n" .
"Execution of - aborted due to compilation errors.\n",
{ stderr => 1 },
'/$a[/<<a with no newline [perl #123712]'
);
fresh_perl_is(
'/$a[m||/<<a',
"Missing right curly or square bracket at - line 1, within pattern\n" .
"syntax error at - line 1, at EOF\n" .
"Execution of - aborted due to compilation errors.\n",
{ stderr => 1 },
'/$a[m||/<<a with no newline [perl #123712]'
);
fresh_perl_is(
'"@{"',
"Missing right curly or square bracket at - line 1, within string\n" .
"syntax error at - line 1, at EOF\n" .
"Execution of - aborted due to compilation errors.\n",
{ stderr => 1 },
'"@{" [perl #123712]'
);
|