summaryrefslogtreecommitdiff
path: root/lib/IPC
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-11-28 17:19:40 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-11-28 17:19:40 +0000
commite3f7a951231ee3b5fdd8b5bc09a32406aaecc2cd (patch)
treed7dc70b16462925e491cdfc399fff5674dca7167 /lib/IPC
parent5c444d3e4e0d8388d89e329d49d5aa1eda0884a5 (diff)
downloadperl-e3f7a951231ee3b5fdd8b5bc09a32406aaecc2cd.tar.gz
Remove DOS line endings
(perforce should take care of line encodings on checkout) p4raw-id: //depot/perl@29411
Diffstat (limited to 'lib/IPC')
-rw-r--r--lib/IPC/Cmd/t/02_Interactive.t220
1 files changed, 110 insertions, 110 deletions
diff --git a/lib/IPC/Cmd/t/02_Interactive.t b/lib/IPC/Cmd/t/02_Interactive.t
index a8d48a0a4f..333f9ffa04 100644
--- a/lib/IPC/Cmd/t/02_Interactive.t
+++ b/lib/IPC/Cmd/t/02_Interactive.t
@@ -1,110 +1,110 @@
-BEGIN { chdir 't' if -d 't' };
-BEGIN { use lib '../lib' };
-
-use strict;
-use File::Spec;
-
-### only run interactive tests when there's someone that can answer them
-use Test::More -t STDOUT
- ? 'no_plan'
- : ( skip_all => "No interactive tests from harness" );
-
-my $Class = 'IPC::Cmd';
-my $Child = File::Spec->catfile( qw[src child.pl] );
-my @FDs = 0..20;
-my $IsWin32 = $^O eq 'MSWin32';
-
-use_ok( $Class, 'run' );
-$IPC::Cmd::DEBUG = 1;
-
-my $Have_IPC_Run = $Class->can_use_ipc_run;
-my $Have_IPC_Open3 = $Class->can_use_ipc_open3;
-
-### configurations to test IPC::Cmd with
-my @Conf = (
- [ $Have_IPC_Run, $Have_IPC_Open3 ],
- [ 0, $Have_IPC_Open3 ],
- [ 0, 0 ]
-);
-
-
-
-
-### first, check which FD's are open. they should be open
-### /after/ we run our tests as well.
-### 0, 1 and 2 should be open, as they are STDOUT, STDERR and STDIN
-### XXX 2 are opened by Test::Builder at least.. this is 'whitebox'
-### knowledge, so unsafe to test against. around line 1322:
-# sub _open_testhandles {
-# return if $Opened_Testhandles;
-# # We dup STDOUT and STDERR so people can change them in their
-# # test suites while still getting normal test output.
-# open(TESTOUT, ">&STDOUT") or die "Can't dup STDOUT: $!";
-# open(TESTERR, ">&STDERR") or die "Can't dup STDERR: $!";
-# $Opened_Testhandles = 1;
-# }
-
-my @Opened;
-{ for ( @FDs ) {
- my $fh;
- my $rv = open $fh, "<&$_";
- push @Opened, $_ if $rv;
- }
- diag( "Opened FDs: @Opened" );
- cmp_ok( scalar(@Opened), '>=', 3,
- "At least 3 FDs are opened" );
-}
-
-for my $aref ( @Conf ) {
-
- ### stupid warnings
- local $IPC::Cmd::USE_IPC_RUN = $aref->[0];
- local $IPC::Cmd::USE_IPC_RUN = $aref->[0];
-
- local $IPC::Cmd::USE_IPC_OPEN3 = $aref->[1];
- local $IPC::Cmd::USE_IPC_OPEN3 = $aref->[1];
-
- diag("Config: IPC::Run = $aref->[0] IPC::Open3 = $aref->[1]");
- ok( -t STDIN, "STDIN attached to a tty" );
-
- for my $cmd ( qq[$^X $Child], qq[$^X $Child | $^X -neprint] ) {
-
- diag("Please enter some input. It will be echo'd back to you");
- my $buffer;
- my $ok = run( command => $cmd, verbose => 1, buffer => \$buffer );
-
- ok( $ok, " Command '$cmd' ran succesfully" );
-
- SKIP: {
- skip "No buffers available", 1 unless $Class->can_capture_buffer;
- ok( defined $buffer, " Input captured" );
- }
- }
-}
-
-### check we didnt leak any FHs
-{ ### should be opened
- my %open = map { $_ => 1 } @Opened;
-
- for ( @FDs ) {
- my $fh;
- my $rv = open $fh, "<&=$_";
-
- ### these should be open
- if( $open{$_} ) {
- ok( $rv, "FD $_ opened" );
- ok( $fh, " FH indeed opened" );
- is( fileno($fh), $_, " Opened at the correct fileno($_)" );
- } else {
- ok( !$rv, "FD $_ not opened" );
- ok( !(fileno($fh)), " FH indeed closed" );
-
- ### extra debug info if tests fail
-# use Devel::Peek;
-# use Data::Dumper;
-# diag( "RV=$rv FH=$fh Fileno=". fileno($fh). Dump($fh) ) if $rv;
-# diag( Dumper( [stat $fh] ) ) if $rv;
-
- }
- }
-}
+BEGIN { chdir 't' if -d 't' };
+BEGIN { use lib '../lib' };
+
+use strict;
+use File::Spec;
+
+### only run interactive tests when there's someone that can answer them
+use Test::More -t STDOUT
+ ? 'no_plan'
+ : ( skip_all => "No interactive tests from harness" );
+
+my $Class = 'IPC::Cmd';
+my $Child = File::Spec->catfile( qw[src child.pl] );
+my @FDs = 0..20;
+my $IsWin32 = $^O eq 'MSWin32';
+
+use_ok( $Class, 'run' );
+$IPC::Cmd::DEBUG = 1;
+
+my $Have_IPC_Run = $Class->can_use_ipc_run;
+my $Have_IPC_Open3 = $Class->can_use_ipc_open3;
+
+### configurations to test IPC::Cmd with
+my @Conf = (
+ [ $Have_IPC_Run, $Have_IPC_Open3 ],
+ [ 0, $Have_IPC_Open3 ],
+ [ 0, 0 ]
+);
+
+
+
+
+### first, check which FD's are open. they should be open
+### /after/ we run our tests as well.
+### 0, 1 and 2 should be open, as they are STDOUT, STDERR and STDIN
+### XXX 2 are opened by Test::Builder at least.. this is 'whitebox'
+### knowledge, so unsafe to test against. around line 1322:
+# sub _open_testhandles {
+# return if $Opened_Testhandles;
+# # We dup STDOUT and STDERR so people can change them in their
+# # test suites while still getting normal test output.
+# open(TESTOUT, ">&STDOUT") or die "Can't dup STDOUT: $!";
+# open(TESTERR, ">&STDERR") or die "Can't dup STDERR: $!";
+# $Opened_Testhandles = 1;
+# }
+
+my @Opened;
+{ for ( @FDs ) {
+ my $fh;
+ my $rv = open $fh, "<&$_";
+ push @Opened, $_ if $rv;
+ }
+ diag( "Opened FDs: @Opened" );
+ cmp_ok( scalar(@Opened), '>=', 3,
+ "At least 3 FDs are opened" );
+}
+
+for my $aref ( @Conf ) {
+
+ ### stupid warnings
+ local $IPC::Cmd::USE_IPC_RUN = $aref->[0];
+ local $IPC::Cmd::USE_IPC_RUN = $aref->[0];
+
+ local $IPC::Cmd::USE_IPC_OPEN3 = $aref->[1];
+ local $IPC::Cmd::USE_IPC_OPEN3 = $aref->[1];
+
+ diag("Config: IPC::Run = $aref->[0] IPC::Open3 = $aref->[1]");
+ ok( -t STDIN, "STDIN attached to a tty" );
+
+ for my $cmd ( qq[$^X $Child], qq[$^X $Child | $^X -neprint] ) {
+
+ diag("Please enter some input. It will be echo'd back to you");
+ my $buffer;
+ my $ok = run( command => $cmd, verbose => 1, buffer => \$buffer );
+
+ ok( $ok, " Command '$cmd' ran succesfully" );
+
+ SKIP: {
+ skip "No buffers available", 1 unless $Class->can_capture_buffer;
+ ok( defined $buffer, " Input captured" );
+ }
+ }
+}
+
+### check we didnt leak any FHs
+{ ### should be opened
+ my %open = map { $_ => 1 } @Opened;
+
+ for ( @FDs ) {
+ my $fh;
+ my $rv = open $fh, "<&=$_";
+
+ ### these should be open
+ if( $open{$_} ) {
+ ok( $rv, "FD $_ opened" );
+ ok( $fh, " FH indeed opened" );
+ is( fileno($fh), $_, " Opened at the correct fileno($_)" );
+ } else {
+ ok( !$rv, "FD $_ not opened" );
+ ok( !(fileno($fh)), " FH indeed closed" );
+
+ ### extra debug info if tests fail
+# use Devel::Peek;
+# use Data::Dumper;
+# diag( "RV=$rv FH=$fh Fileno=". fileno($fh). Dump($fh) ) if $rv;
+# diag( Dumper( [stat $fh] ) ) if $rv;
+
+ }
+ }
+}