diff options
author | David Mitchell <davem@iabyn.com> | 2011-07-20 14:39:20 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2011-07-20 15:55:06 +0100 |
commit | 64eff8b72e154607aa99f7713bd4d05c443be47f (patch) | |
tree | 19864af98f615e53b47dd052e2a866cb63bba30f /t/op/write.t | |
parent | ad5e438df86ffad2a70e2a2a5f142bdf5eb7da7b (diff) | |
download | perl-64eff8b72e154607aa99f7713bd4d05c443be47f.tar.gz |
make assign to $^A update FmLINES
Currently assigning to $^A updates the string in
PL_bodytarget, but doesn't update FmLINES(PL_bodytarget).
This can cause later writes to get confused about how many
lines have been output, and was causing write.t to fail test 418
under miniperl. (Only under miniperl, because skipping some tests under
miniperl affected how $^A's content and line count got messed up).
Fix this by updating FmLINES(PL_bodytarget) when $^A is set.
(Also fixes a TODO test which was failing due to 'local $^A' in earlier
tests)
Diffstat (limited to 't/op/write.t')
-rw-r--r-- | t/op/write.t | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/t/op/write.t b/t/op/write.t index d30c9d77ef..8be0b41176 100644 --- a/t/op/write.t +++ b/t/op/write.t @@ -61,7 +61,7 @@ for my $tref ( @NumTests ){ my $bas_tests = 20; # number of tests in section 3 -my $bug_tests = 4 + 3 * 3 * 5 * 2 * 3 + 2 + 66 + 4 + 2 + 1 + 1; +my $bug_tests = 4 + 3 * 3 * 5 * 2 * 3 + 2 + 66 + 4 + 2 + 3; # number of tests in section 4 my $hmb_tests = 35; @@ -593,7 +593,7 @@ $test . -# [ID 20020227.005] format bug with undefined _TOP +# RT #8698 format bug with undefined _TOP open STDOUT_DUP, ">&STDOUT"; my $oldfh = select STDOUT_DUP; @@ -602,10 +602,7 @@ $= = 10; local $~ = "Comment"; write; curr_test($test + 1); - { - local $::TODO = '[ID 20020227.005] format bug with undefined _TOP'; - is $-, 9; - } + is $-, 9; is $^, "STDOUT_DUP_TOP"; } select $oldfh; @@ -735,6 +732,33 @@ SKIP: { is $buf, "ok $test\n", "write to duplicated format"; } +format caret_A_test_TOP = +T +. + +format caret_A_test = +L1 +L2 +L3 +L4 +. + +SKIP: { + skip_if_miniperl('miniperl does not support scalario'); + my $buf = ""; + open my $fh, ">", \$buf; + my $old_fh = select $fh; + local $^ = "caret_A_test_TOP"; + local $~ = "caret_A_test"; + local $= = 3; + local $^A = "A1\nA2\nA3\nA4\n"; + write; + select $old_fh; + close $fh; + is $buf, "T\nA1\nA2\n\fT\nA3\nA4\n\fT\nL1\nL2\n\fT\nL3\nL4\n", + "assign to ^A sets FmLINES"; +} + fresh_perl_like(<<'EOP', qr/^Format STDOUT redefined at/, {stderr => 1}, '#64562 - Segmentation fault with redefined formats and warnings'); #!./perl |