]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 295205 - runtests.pl should check that the line endings of files conform to...
authorwurblzap%gmail.com <>
Sun, 1 Mar 2009 10:31:14 +0000 (10:31 +0000)
committerwurblzap%gmail.com <>
Sun, 1 Mar 2009 10:31:14 +0000 (10:31 +0000)
Patch by Marc Schumann <wurblzap@gmail.com>.
r=LpSolit,mkanat; a=mkanat.

t/005whitespace.t

index 75f532956211f26c9c2dd85dfd45121cbad733d3..e6bd07f4ec03e611583fbc81a54475e23a09685a 100644 (file)
@@ -19,6 +19,8 @@
 #
 # Contributor(s): Jacob Steenhagen <jake@bugzilla.org>
 #                 David D. Kilzer <ddkilzer@kilzer.net>
+#                 Colin Ogilvie <mozilla@colinogilvie.co.uk>
+#                 Marc Schumann <wurblzap@gmail.com>
 #
 
 #################
@@ -34,7 +36,7 @@ use Support::Templates;
 
 use File::Spec;
 use Test::More tests => (  scalar(@Support::Files::testitems)
-                         + $Support::Templates::num_actual_files);
+                         + $Support::Templates::num_actual_files) * 2;
 
 my @testitems = @Support::Files::testitems;
 for my $path (@Support::Templates::include_paths) {
@@ -42,9 +44,12 @@ for my $path (@Support::Templates::include_paths) {
                         Support::Templates::find_actual_files($path)));
 }
 
+my %results;
+
 foreach my $file (@testitems) {
     open (FILE, "$file");
-    if (grep /\t/, <FILE>) {
+    my @contents = <FILE>;
+    if (grep /\t/, @contents) {
         ok(0, "$file contains tabs --WARNING");
     } else {
         ok(1, "$file has no tabs");
@@ -52,4 +57,15 @@ foreach my $file (@testitems) {
     close (FILE);
 }
 
+foreach my $file (@testitems) {
+    open (FILE, "$file");
+    my @contents = <FILE>;
+    if (grep /\r/, @contents) {
+        ok(0, "$file contains non-OS-conformant line endings --WARNING");
+    } else {
+        ok(1, "All line endings of $file are OS conformant");
+    }
+    close (FILE);
+}
+
 exit 0;