Commit | Line | Data |
79628082 |
1 | #!./perl |
2 | |
3 | BEGIN { |
4 | chdir 't'; |
5 | @INC = '../lib'; |
6 | require './test.pl'; |
7 | } |
8 | |
bc44a8a2 |
9 | plan tests => 11; |
79628082 |
10 | |
11 | eval { for (\2) { $_ = <FH> } }; |
12 | like($@, 'Modification of a read-only value attempted', '[perl #19566]'); |
13 | |
ba92458f |
14 | { |
15 | open A,"+>a"; $a = 3; |
16 | is($a .= <A>, 3, '#21628 - $a .= <A> , A eof'); |
17 | close A; $a = 4; |
18 | is($a .= <A>, 4, '#21628 - $a .= <A> , A closed'); |
19 | unlink "a"; |
20 | } |
10bcdfd6 |
21 | |
22 | # 82 is chosen to exceed the length for sv_grow in do_readline (80) |
bfe0b846 |
23 | foreach my $k (1, 82) { |
10bcdfd6 |
24 | my $result |
25 | = runperl (switches => '-l', stdin => '', stderr => 1, |
bfe0b846 |
26 | prog => "\$x = q(k) x $k; \$a{\$x} = qw(v); \$_ = <> foreach keys %a; print qw(end)", |
10bcdfd6 |
27 | ); |
bfe0b846 |
28 | $result =~ s/\n\z// if $^O eq 'VMS'; |
29 | is ($result, "end", '[perl #21614] for length ' . length('k' x $k)); |
10bcdfd6 |
30 | } |
bc44a8a2 |
31 | |
32 | |
bfe0b846 |
33 | foreach my $k (1, 21) { |
bc44a8a2 |
34 | my $result |
35 | = runperl (switches => '-l', stdin => ' rules', stderr => 1, |
bfe0b846 |
36 | prog => "\$x = q(perl) x $k; \$a{\$x} = q(v); foreach (keys %a) {\$_ .= <>; print}", |
bc44a8a2 |
37 | ); |
bfe0b846 |
38 | $result =~ s/\n\z// if $^O eq 'VMS'; |
39 | is ($result, ('perl' x $k) . " rules", 'rcatline to shared sv for length ' . length('perl' x $k)); |
bc44a8a2 |
40 | } |
41 | |
42 | foreach my $l (1, 82) { |
43 | my $k = $l; |
44 | $k = 'k' x $k; |
45 | my $copy = $k; |
46 | $k = <DATA>; |
47 | is ($k, "moo\n", 'catline to COW sv for length ' . length $copy); |
48 | } |
49 | |
50 | |
51 | foreach my $l (1, 21) { |
52 | my $k = $l; |
53 | $k = 'perl' x $k; |
54 | my $perl = $k; |
55 | $k .= <DATA>; |
56 | is ($k, "$perl rules\n", 'rcatline to COW sv for length ' . length $perl); |
57 | } |
58 | __DATA__ |
59 | moo |
60 | moo |
61 | rules |
62 | rules |