In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/f63a114b48be4e9c44534b6e07ecdeea8be2ef71?hp=54db7d57c29c9259228a6a4176caa32e391c6d0b>
- Log ----------------------------------------------------------------- commit f63a114b48be4e9c44534b6e07ecdeea8be2ef71 Author: Rafael Garcia-Suarez <r...@consttype.org> Date: Wed Oct 1 09:13:05 2014 +0200 Add tests for overriding <> versus rcatline M t/op/override.t commit 8710cf8f5f6839aad48677237bbf16e56c839dcd Author: Rafael Garcia-Suarez <r...@consttype.org> Date: Wed Oct 1 09:03:10 2014 +0200 New <<>> tests - Modify test to test also that <<>> with empty (false) lines - Add a test for <<>> used in a rcatline op M t/io/argv.t ----------------------------------------------------------------------- Summary of changes: t/io/argv.t | 14 ++++++++++---- t/op/override.t | 14 ++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/t/io/argv.t b/t/io/argv.t index 397bb71..8abb82e 100644 --- a/t/io/argv.t +++ b/t/io/argv.t @@ -7,7 +7,7 @@ BEGIN { BEGIN { require "./test.pl"; } -plan(tests => 35); +plan(tests => 36); my ($devnull, $no_devnull); @@ -155,14 +155,20 @@ SKIP: { } open(TRY, '>Io_argv1.tmp') || (die "Can't open temp file: $!"); -print TRY "one\ntwo\n"; +print TRY "one\n\nthree\n"; close TRY or die "Could not close: $!"; $x = runperl( prog => 'print $..$ARGV.$_ while <<>>', args => [ 'Io_argv1.tmp' ], ); -is($x, "1Io_argv1.tmpone\n2Io_argv1.tmptwo\n", '<<>>'); +is($x, "1Io_argv1.tmpone\n2Io_argv1.tmp\n3Io_argv1.tmpthree\n", '<<>>'); + +$x = runperl( + prog => '$w=q/b/;$w.=<<>>;print $w', + args => [ 'Io_argv1.tmp' ], +); +is($x, "bone\n", '<<>> and rcatline'); $x = runperl( prog => 'while (<<>>) { print }', @@ -214,7 +220,7 @@ SKIP: { stderr => 1, args => [ 'Io_argv1.tmp', '"echo foo |"' ], ); - is($x, "Can't open echo foo |: No such file or directory at -e line 1, <> line 2.\n", '<<>> does not treat ...| as fork after eof'); + is($x, "Can't open echo foo |: No such file or directory at -e line 1, <> line 3.\n", '<<>> does not treat ...| as fork after eof'); } # This used to dump core diff --git a/t/op/override.t b/t/op/override.t index 1d45617..ead2606 100644 --- a/t/op/override.t +++ b/t/op/override.t @@ -8,7 +8,7 @@ BEGIN { require 'Config_heavy.pl'; # since runperl will need them } -plan tests => 35; +plan tests => 37; # # This file tries to test builtin override using CORE::GLOBAL @@ -93,14 +93,20 @@ is( <FH> , 12 ); is( <$fh> , 13 ); my $pad_fh; is( <$pad_fh> , 14 ); +{ + my $buf = ''; $buf .= <FH>; + is( $buf, 15, 'rcatline' ); +} # Non-global readline() override BEGIN { *Rgs::readline = sub (;*) { --$r }; } { package Rgs; - ::is( <FH> , 13 ); - ::is( <$fh> , 12 ); - ::is( <$pad_fh> , 11 ); + ::is( <FH> , 14 ); + ::is( <$fh> , 13 ); + ::is( <$pad_fh> , 12 ); + my $buf = ''; $buf .= <FH>; + ::is( $buf, 11, 'rcatline' ); } # Global readpipe() override -- Perl5 Master Repository