|
| 1 | +diff --git a/.gitattributes b/.gitattributes |
| 2 | +index b96c7fd985..7c9b72b889 100644 |
| 3 | +--- a/.gitattributes |
| 4 | ++++ b/.gitattributes |
| 5 | +@@ -35,3 +35,7 @@ |
| 6 | + |
| 7 | + # Define some file types explicitly as being binary. |
| 8 | + *.jar binary |
| 9 | ++ |
| 10 | ++# Define rules for files in specific paths, such as test data, |
| 11 | ++# for line endings, binary types etc. |
| 12 | ++java/java.hints/test/unit/data/goldenfiles/** text eol=lf |
| 13 | +diff --git a/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/infrastructure/TreeRuleTestBase.java b/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/infrastructure/TreeRuleTestBase.java |
| 14 | +index ede2a586e888..a351d52bd5fc 100644 |
| 15 | +--- a/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/infrastructure/TreeRuleTestBase.java |
| 16 | ++++ b/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/infrastructure/TreeRuleTestBase.java |
| 17 | +@@ -242,9 +242,11 @@ protected String performFixTest(String fileName, String code, int pos, String er |
| 18 | + String realCode = toCheckDocument.getText(0, toCheckDocument.getLength()); |
| 19 | + |
| 20 | + //ignore whitespaces: |
| 21 | +- realCode = realCode.replaceAll("[ \t\n]+", " "); |
| 22 | ++ realCode = realCode.replaceAll("\\s+", " "); |
| 23 | + |
| 24 | + if (golden != null) { |
| 25 | ++ //ignore CRLF/LF differences in golden: |
| 26 | ++ if (!"\n".equals(System.lineSeparator())) golden = golden.replaceAll(System.lineSeparator(), " "); |
| 27 | + assertEquals("The output code does not match the expected code.", golden, realCode); |
| 28 | + } |
| 29 | + |
| 30 | +diff --git a/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorkerTest.java b/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorkerTest.java |
| 31 | +index bcd1c07c8701..fb4f11400726 100644 |
| 32 | +--- a/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorkerTest.java |
| 33 | ++++ b/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorkerTest.java |
| 34 | +@@ -685,6 +685,7 @@ public void testPreserveValidMethods1() throws Exception { |
| 35 | + " System.err.println(\"Hello, world!\");\n" + |
| 36 | + " }\n" + |
| 37 | + "}"); |
| 38 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 39 | + assertEquals(expected, file2Fixed); |
| 40 | + } |
| 41 | + |
| 42 | +@@ -729,6 +730,7 @@ public void testClearInvalidMethod() throws Exception { |
| 43 | + " throw new java.lang.RuntimeException(\"Uncompilable code - compiler.err.cant.resolve.location\");\n" + |
| 44 | + " }\n" + |
| 45 | + "}"); |
| 46 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 47 | + assertEquals(expected, file2Fixed); |
| 48 | + } |
| 49 | + |
| 50 | +@@ -792,6 +794,7 @@ public void testPreserveValidInitializers() throws Exception { |
| 51 | + " private int F5a;\n" + |
| 52 | + " private int F5b;\n" + |
| 53 | + "}"); |
| 54 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 55 | + assertEquals(expected, file2Fixed); |
| 56 | + } |
| 57 | + |
| 58 | +@@ -834,6 +837,7 @@ public void testBrokenClassHeader1() throws Exception { |
| 59 | + " throw new java.lang.RuntimeException(\"Uncompilable code\");\n" + |
| 60 | + " }\n" + |
| 61 | + "}"); |
| 62 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 63 | + assertEquals(expected, file2Fixed); |
| 64 | + } |
| 65 | + |
| 66 | +@@ -883,6 +887,7 @@ public void testNullReturnUnknown() throws Exception { |
| 67 | + " throw new java.lang.RuntimeException(\"Uncompilable code\");\n" + |
| 68 | + " }\n" + |
| 69 | + "}"); |
| 70 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 71 | + assertEquals(expected, file2Fixed); |
| 72 | + } |
| 73 | + |
| 74 | +@@ -932,6 +937,7 @@ public void testBrokenNewClass() throws Exception { |
| 75 | + " throw new java.lang.RuntimeException(\"Uncompilable code\");\n" + |
| 76 | + " }\n" + |
| 77 | + "}"); |
| 78 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 79 | + assertEquals(expected, file2Fixed); |
| 80 | + } |
| 81 | + |
| 82 | +@@ -983,6 +989,7 @@ public void testReturnBroken() throws Exception { |
| 83 | + " throw new java.lang.RuntimeException(\"Uncompilable code\");\n" + |
| 84 | + " }\n" + |
| 85 | + "}"); |
| 86 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 87 | + assertEquals(expected, file2Fixed); |
| 88 | + } |
| 89 | + |
| 90 | +@@ -1037,6 +1044,7 @@ public void testAssertBroken() throws Exception { |
| 91 | + " throw new java.lang.RuntimeException(\"Uncompilable code\");\n" + |
| 92 | + " }\n" + |
| 93 | + "}"); |
| 94 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 95 | + assertEquals(expected, file2Fixed); |
| 96 | + } |
| 97 | + |
| 98 | +@@ -1117,6 +1125,7 @@ public void testAnonymousComplex() throws Exception { |
| 99 | + " };\n" + |
| 100 | + " }\n" + |
| 101 | + "}"); |
| 102 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 103 | + assertEquals(expected, file2Fixed); |
| 104 | + } |
| 105 | + |
| 106 | +@@ -1165,6 +1174,7 @@ public void testFieldInit() throws Exception { |
| 107 | + " super();\n" + |
| 108 | + " }\n" + |
| 109 | + "}"); |
| 110 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 111 | + assertEquals(expected, file2Fixed); |
| 112 | + } |
| 113 | + |
| 114 | +@@ -1239,6 +1249,7 @@ public void testAnonymousComplex2() throws Exception { |
| 115 | + " }\n" + |
| 116 | + " }\n" + |
| 117 | + "}"); |
| 118 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 119 | + assertEquals(expected, file2Fixed); |
| 120 | + } |
| 121 | + |
| 122 | +@@ -1285,6 +1296,7 @@ public void testNewClass() throws Exception { |
| 123 | + " throw new java.lang.RuntimeException(\"Uncompilable code - compiler.err.cant.apply.symbol\");\n" + |
| 124 | + " }\n" + |
| 125 | + "}"); |
| 126 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 127 | + assertEquals(expected, file2Fixed); |
| 128 | + } |
| 129 | + |
| 130 | +@@ -1336,6 +1348,7 @@ public void testUndefNewArray() throws Exception { |
| 131 | + " throw new java.lang.RuntimeException(\"Uncompilable code\");\n" + |
| 132 | + " }\n" + |
| 133 | + "}"); |
| 134 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 135 | + assertEquals(expected, file2Fixed); |
| 136 | + } |
| 137 | + |
| 138 | +@@ -1412,6 +1425,7 @@ public void testUndefAnonymous() throws Exception { |
| 139 | + " }\n" + |
| 140 | + " }\n" + |
| 141 | + "}"); |
| 142 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 143 | + assertEquals(expected, file2Fixed); |
| 144 | + } |
| 145 | + |
| 146 | +@@ -1471,6 +1485,7 @@ public void testWeirdSuperCall() throws Exception { |
| 147 | + " }\n" + |
| 148 | + " }\n" + |
| 149 | + "}"); |
| 150 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 151 | + assertEquals(expected, file2Fixed); |
| 152 | + } |
| 153 | + |
| 154 | +@@ -1590,6 +1605,7 @@ public void testAnonymousComplex3() throws Exception { |
| 155 | + " }\n" + |
| 156 | + " }\n" + |
| 157 | + "}"); |
| 158 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 159 | + assertEquals(expected, file2Fixed); |
| 160 | + } |
| 161 | + |
| 162 | +@@ -1690,6 +1706,7 @@ public void testAnonymousComplex4() throws Exception { |
| 163 | + " throw new java.lang.RuntimeException(\"Uncompilable code - compiler.err.cant.resolve.location.args\");\n" + |
| 164 | + " }\n" + |
| 165 | + "}"); |
| 166 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 167 | + assertEquals(expected, file2Fixed); |
| 168 | + } |
| 169 | + |
| 170 | +@@ -1763,6 +1780,7 @@ public void testAnonymousComplexCorrect() throws Exception { |
| 171 | + " }\n" + |
| 172 | + " }\n" + |
| 173 | + "}"); |
| 174 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 175 | + assertEquals(expected, file2Fixed); |
| 176 | + } |
| 177 | + |
| 178 | +@@ -1806,6 +1824,7 @@ public void testWarningsAreNotErrors() throws Exception { |
| 179 | + " }\n" + |
| 180 | + " Test t;\n" + |
| 181 | + "}"); |
| 182 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 183 | + assertEquals(expected, file2Fixed); |
| 184 | + } |
| 185 | + |
| 186 | +@@ -1878,6 +1897,7 @@ public void testSuperCall() throws Exception { |
| 187 | + " public default void test2() {\n" + |
| 188 | + " }\n" + |
| 189 | + "}"); |
| 190 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 191 | + assertEquals(expected, file2Fixed); |
| 192 | + } |
| 193 | + |
| 194 | +@@ -1923,6 +1943,7 @@ public void testStaticInit() throws Exception { |
| 195 | + " System.err.println();\n" + |
| 196 | + " }\n" + |
| 197 | + "}"); |
| 198 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 199 | + assertEquals(expected, file2Fixed); |
| 200 | + } |
| 201 | + |
| 202 | +@@ -2161,6 +2182,7 @@ public void testMethodWithErroneousInMemberRef() throws Exception { |
| 203 | + " \n" + |
| 204 | + " public Object test(Object o);\n" + |
| 205 | + "}"); |
| 206 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 207 | + assertEquals(expected, file2Fixed); |
| 208 | + } |
| 209 | + |
| 210 | +@@ -2242,6 +2264,7 @@ public void testPatternSwitch() throws Exception { |
| 211 | + " throw new java.lang.RuntimeException(\"Uncompilable code\");\n" + |
| 212 | + " }\n" + |
| 213 | + "}"); |
| 214 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 215 | + assertEquals(expected, file2Fixed); |
| 216 | + } |
| 217 | + |
| 218 | +@@ -2294,6 +2317,7 @@ public void testTypeTest() throws Exception { |
| 219 | + " }\n" + |
| 220 | + " }\n" + |
| 221 | + "}"); |
| 222 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 223 | + assertEquals(expected, file2Fixed); |
| 224 | + } |
| 225 | + |
| 226 | +@@ -2339,6 +2363,7 @@ public void testWrongRecordComponent() throws Exception { |
| 227 | + " }\n" + |
| 228 | + " private final int wait;\n" + |
| 229 | + "}"); |
| 230 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 231 | + assertEquals(expected, file2Fixed); |
| 232 | + } |
| 233 | + |
| 234 | +@@ -2391,6 +2416,7 @@ public void testRecord1() throws Exception { |
| 235 | + " }\n" + |
| 236 | + " private final int i;\n" + |
| 237 | + "}"); |
| 238 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 239 | + assertEquals(expected, file2Fixed); |
| 240 | + } |
| 241 | + |
| 242 | +@@ -2428,6 +2454,7 @@ public void testRecord2() throws Exception { |
| 243 | + " }\n" + |
| 244 | + " private final int i;\n" + |
| 245 | + "}"); |
| 246 | ++ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n")); |
| 247 | + assertEquals(expected, file2Fixed); |
| 248 | + } |
| 249 | + |
0 commit comments