This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Tweak IPC-Open3.t to cope with \r\n line endings on Win32.
authorNicholas Clark <nick@ccl4.org>
Mon, 20 Dec 2010 14:02:39 +0000 (14:02 +0000)
committerNicholas Clark <nick@ccl4.org>
Mon, 20 Dec 2010 14:02:39 +0000 (14:02 +0000)
The refactoring of bd29e8c290c68f4f to use Test::More broke the tests on Win32,
because it didn't realise that the previous code was relying on the test
harness being line ending agnostic.

ext/IPC-Open3/t/IPC-Open3.t

index 613ab7b..9bc80da 100644 (file)
@@ -61,9 +61,9 @@ $pid = open3 'WRITE', 'READ', 'READ', $perl, '-e', cmd_line(<<'EOF');
     print STDERR scalar <STDIN>;
 EOF
 print WRITE "$desc\n";
-is(scalar <READ>, "$desc\n");
+like(scalar <READ>, qr/\A$desc\r?\n\z/);
 print WRITE "$desc [again]\n";
-is(scalar <READ>, "$desc [again]\n");
+like(scalar <READ>, qr/\A$desc \[again\]\r?\n\z/);
 waitpid $pid, 0;
 
 $desc = "read and error together, error empty";
@@ -73,9 +73,9 @@ $pid = open3 'WRITE', 'READ', '', $perl, '-e', cmd_line(<<'EOF');
     print STDERR scalar <STDIN>;
 EOF
 print WRITE "$desc\n";
-is(scalar <READ>, "$desc\n");
+like(scalar <READ>, qr/\A$desc\r?\n\z/);
 print WRITE "$desc [again]\n";
-is(scalar <READ>, "$desc [again]\n");
+like(scalar <READ>, qr/\A$desc \[again\]\r?\n\z/);
 waitpid $pid, 0;
 
 is(pipe(PIPE_READ, PIPE_WRITE), 1);
@@ -84,7 +84,7 @@ $pid = open3 '<&PIPE_READ', 'READ', '',
 close PIPE_READ;
 print PIPE_WRITE "dup writer\n";
 close PIPE_WRITE;
-is(scalar <READ>, "dup writer\n");
+like(scalar <READ>, qr/\Adup writer\r?\n\z/);
 waitpid $pid, 0;
 
 my $TB = Test::Builder->new();