OLD | NEW |
1 #!/usr/bin/perl -w | 1 #!/usr/bin/perl -w |
2 # | 2 # |
3 # Copyright (C) 2011 Research In Motion Limited. All rights reserved. | 3 # Copyright (C) 2011 Research In Motion Limited. All rights reserved. |
4 # Copyright (C) 2013 Apple Inc. All rights reserved. | 4 # Copyright (C) 2013 Apple Inc. All rights reserved. |
5 # | 5 # |
6 # This library is free software; you can redistribute it and/or | 6 # This library is free software; you can redistribute it and/or |
7 # modify it under the terms of the GNU Lesser General Public | 7 # modify it under the terms of the GNU Lesser General Public |
8 # License as published by the Free Software Foundation; either | 8 # License as published by the Free Software Foundation; either |
9 # version 2.1 of the License, or (at your option) any later version. | 9 # version 2.1 of the License, or (at your option) any later version. |
10 # | 10 # |
11 # This library is distributed in the hope that it will be useful, | 11 # This library is distributed in the hope that it will be useful, |
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 # Lesser General Public License for more details. | 14 # Lesser General Public License for more details. |
15 # | 15 # |
16 # You should have received a copy of the GNU Lesser General Public | 16 # You should have received a copy of the GNU Lesser General Public |
17 # License along with this library; if not, write to the Free Software | 17 # License along with this library; if not, write to the Free Software |
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
19 | 19 |
20 # Unit tests of parseDiff() with mock files; test override of patch EOL with EOL
of target file. | 20 # Unit tests of parseDiff() with mock files; test override of patch EOL with EOL
of target file. |
21 | 21 |
22 use strict; | 22 use strict; |
23 use warnings; | 23 use warnings; |
24 | 24 |
25 use File::Temp; | 25 use File::Temp; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 Index: Makefile | 100 Index: Makefile |
101 =================================================================== | 101 =================================================================== |
102 --- Makefile (revision 53052) | 102 --- Makefile (revision 53052) |
103 +++ Makefile (working copy) | 103 +++ Makefile (working copy) |
104 @@ -1,3 +1,4 @@ | 104 @@ -1,3 +1,4 @@ |
105 EOF | 105 EOF |
106 | 106 |
107 my $diffBody = <<EOF; | 107 my $diffBody = <<EOF; |
108 + | 108 + |
109 MODULES = JavaScriptCore JavaScriptGlue WebCore WebKit WebKitTools | 109 MODULES = JavaScriptCore JavaScriptGlue WebCore WebKit WebKitTools |
110 | 110 |
111 all: | 111 all: |
112 EOF | 112 EOF |
113 | 113 |
114 my $MakefileContents = <<EOF; | 114 my $MakefileContents = <<EOF; |
115 MODULES = JavaScriptCore JavaScriptGlue WebCore WebKit WebKitTools | 115 MODULES = JavaScriptCore JavaScriptGlue WebCore WebKit WebKitTools |
116 | 116 |
117 all: | 117 all: |
118 EOF | 118 EOF |
119 | 119 |
120 my $mockDir = File::Temp->tempdir("parseDiffXXXX", CLEANUP => 1); | 120 my $mockDir = File::Temp->tempdir("parseDiffXXXX", CLEANUP => 1); |
121 writeToFile(File::Spec->catfile($mockDir, "MakefileWithUnixEOL"), $MakefileConte
nts); | 121 writeToFile(File::Spec->catfile($mockDir, "MakefileWithUnixEOL"), $MakefileConte
nts); |
122 writeToFile(File::Spec->catfile($mockDir, "MakefileWithWindowsEOL"), toWindowsLi
neEndings($MakefileContents)); | 122 writeToFile(File::Spec->catfile($mockDir, "MakefileWithWindowsEOL"), toWindowsLi
neEndings($MakefileContents)); |
123 writeToFile(File::Spec->catfile($mockDir, "MakefileWithMacEOL"), toMacLineEnding
s($MakefileContents)); | 123 writeToFile(File::Spec->catfile($mockDir, "MakefileWithMacEOL"), toMacLineEnding
s($MakefileContents)); |
124 | 124 |
125 # The array of test cases. | 125 # The array of test cases. |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 return $string; | 477 return $string; |
478 } | 478 } |
479 | 479 |
480 sub writeToFile | 480 sub writeToFile |
481 { | 481 { |
482 my ($file, $text) = @_; | 482 my ($file, $text) = @_; |
483 open(FILE, ">$file") or die; | 483 open(FILE, ">$file") or die; |
484 print FILE $text; | 484 print FILE $text; |
485 close(FILE); | 485 close(FILE); |
486 } | 486 } |
OLD | NEW |