cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH 1/4] runtests.pl: reverse line-ending conversion on Windows

From: Marc Hoersken <info_at_marc-hoersken.de>
Date: Sun, 26 Jan 2014 11:23:11 +0100

It makes more sense to convert the expected output to [CR][LF] on
Windows than to force the actual, probably correct, output to [LF].

This way it is actually possible to see if curl outputs the correct
line-ending excepted by a text-aware test case.

---
 tests/runtests.pl | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tests/runtests.pl b/tests/runtests.pl
index b459c33..e63aa03 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -3616,7 +3616,8 @@ sub singletest {
         my $filemode=$hash{'mode'};
         if($filemode && ($filemode eq "text") && $has_textaware) {
             # text mode when running on windows: fix line endings
-            map s/\r\n/\n/g, @actual;
+            map s/\r\n/\n/g, @validstdout;
+            map s/\n/\r\n/g, @validstdout;
         }
 
         if($hash{'nonewline'}) {
@@ -3644,7 +3645,8 @@ sub singletest {
         my $filemode=$hash{'mode'};
         if($filemode && ($filemode eq "text") && $has_textaware) {
             # text mode when running on windows: fix line endings
-            map s/\r\n/\n/g, @out;
+            map s/\r\n/\n/g, @reply;
+            map s/\n/\r\n/g, @reply;
         }
 
         $res = compare($testnum, $testname, "data", \@out, \@reply);
@@ -3788,9 +3790,9 @@ sub singletest {
 
             my $filemode=$hash{'mode'};
             if($filemode && ($filemode eq "text") && $has_textaware) {
-                # text mode when running on windows means adding an extra
-                # strip expression
-                push @stripfile, "s/\r\n/\n/";
+                # text mode when running on windows: fix line endings
+                map s/\r\n/\n/g, @outfile;
+                map s/\n/\r\n/g, @outfile;
             }
 
             my $strip;
-- 
1.8.1.msysgit.1
--------------010500040702000407000504
Content-Type: text/plain; charset=windows-1252;
 name="0002-ftpserver.pl-directory-LISTings-use-CR-LF-for-ASCII-.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0002-ftpserver.pl-directory-LISTings-use-CR-LF-for-ASCII-.pa";
 filename*1="tch"
Received on 2001-09-17