Skip to content

Commit d5c1402

Browse files
slarsewoutersmeenk
authored andcommitted
chore: Disable Git's autocrlf feature to fix Windows build failures (INRIA#3881)
1 parent abaf430 commit d5c1402

File tree

6 files changed

+2
-45
lines changed

6 files changed

+2
-45
lines changed

.github/workflows/tests.yml

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ jobs:
3737

3838
name: Tests with Java ${{ matrix.java }} on ${{ matrix.os }}
3939
steps:
40+
- name: Disable Git's autocrlf
41+
run: git config --global core.autocrlf false
4042
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
4143
- uses: actions/setup-java@8764a52df183aa0ccea74521dfd9d506ffc7a19a # v2.0.0
4244
with:

src/test/java/spoon/test/compilationunit/TestCompilationUnit.java

-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
import static org.junit.Assert.assertSame;
5555
import static org.junit.Assert.assertTrue;
5656
import static org.junit.Assert.fail;
57-
import static spoon.test.SpoonTestHelpers.assumeNotWindows;
5857

5958

6059
/**
@@ -304,7 +303,6 @@ private Charset detectEncodingDummy(SpoonFile unused, byte[] fileBytes) {
304303

305304
@Test
306305
public void testDifferentEncodings() throws Exception {
307-
assumeNotWindows(); // FIXME Make test case pass on Windows
308306
//contract: both utf-8 and cp1251 files in the same project should be handled properly
309307
final Launcher launcher = new Launcher();
310308
launcher.addInputResource("./src/test/resources/encodings/Cp1251.java");

src/test/java/spoon/test/pkg/PackageTest.java

-2
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,13 @@
5858
import static org.junit.Assert.assertSame;
5959
import static org.junit.Assert.assertTrue;
6060
import static org.junit.Assert.fail;
61-
import static spoon.test.SpoonTestHelpers.assumeNotWindows;
6261
import static spoon.testing.Assert.assertThat;
6362
import static spoon.testing.utils.ModelUtils.canBeBuilt;
6463

6564
public class PackageTest {
6665

6766
@Test
6867
public void testPackage() throws Exception {
69-
assumeNotWindows(); // FIXME Make test case pass on Windows
7068
final String classFilePath = "./src/test/java/spoon/test/pkg/name/PackageTestClass.java";
7169
final String packageInfoFilePath = "./src/test/java/spoon/test/pkg/package-info.java";
7270
final File packageInfoFile = new File(packageInfoFilePath);

src/test/java/spoon/test/position/PositionTest.java

-20
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,13 @@
110110
import static org.junit.Assert.assertTrue;
111111
import static org.junit.Assert.fail;
112112
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
113-
import static spoon.test.SpoonTestHelpers.assumeNotWindows;
114113
import static spoon.testing.utils.ModelUtils.build;
115114
import static spoon.testing.utils.ModelUtils.buildClass;
116115

117116
public class PositionTest {
118117

119118
@Test
120119
public void testPositionClass() {
121-
assumeNotWindows(); // FIXME Make test case pass on Windows
122120
final Factory build = build(new File("src/test/java/spoon/test/position/testclasses/"));
123121
final CtType<FooClazz> foo = build.Type().get(FooClazz.class);
124122
String classContent = getClassContent(foo);
@@ -150,7 +148,6 @@ public void testPositionClass() {
150148

151149
@Test
152150
public void testPositionClassWithComments() {
153-
assumeNotWindows(); // FIXME Make test case pass on Windows
154151
//contract: check that comments before and after the 'class' keyword are handled well by PositionBuilder
155152
//and it produces correct `modifierEnd`
156153
final Factory build = build(new File("src/test/java/spoon/test/position/testclasses/"));
@@ -191,7 +188,6 @@ public void testPositionClassWithComments() {
191188

192189
@Test
193190
public void testPositionParameterTypeReference() throws Exception {
194-
assumeNotWindows(); // FIXME Make test case pass on Windows
195191
//contract: the parameterized type reference has a source position which includes parameter types, etc.
196192
final CtType<?> foo = buildClass(PositionParameterTypeWithReference.class);
197193
String classContent = getClassContent(foo);
@@ -239,7 +235,6 @@ public void testPositionParameterTypeReference() throws Exception {
239235

240236
@Test
241237
public void testPositionInterface() {
242-
assumeNotWindows(); // FIXME Make test case pass on Windows
243238
final Factory build = build(new File("src/test/java/spoon/test/position/testclasses/"));
244239
final CtType<FooInterface> foo = build.Type().get(FooInterface.class);
245240
String classContent = getClassContent(foo);
@@ -274,7 +269,6 @@ public void testPositionInterface() {
274269

275270
@Test
276271
public void testPositionAnnotation() {
277-
assumeNotWindows(); // FIXME Make test case pass on Windows
278272
final Factory build = build(new File("src/test/java/spoon/test/position/testclasses/"));
279273
final CtType<FooAnnotation> foo = build.Type().get(FooAnnotation.class);
280274
String classContent = getClassContent(foo);
@@ -318,7 +312,6 @@ public void testPositionAnnotation() {
318312

319313
@Test
320314
public void testPositionField() throws Exception {
321-
assumeNotWindows(); // FIXME Make test case pass on Windows
322315
final Factory build = build(FooField.class);
323316
final CtType<FooField> foo = build.Type().get(FooField.class);
324317
String classContent = getClassContent(foo);
@@ -382,7 +375,6 @@ public void testPositionField() throws Exception {
382375

383376
@Test
384377
public void testPositionGeneric() throws Exception {
385-
assumeNotWindows(); // FIXME Make test case pass on Windows
386378
final Factory build = build(FooGeneric.class);
387379
final CtClass<FooGeneric> foo = build.Class().get(FooGeneric.class);
388380
String classContent = getClassContent(foo);
@@ -444,7 +436,6 @@ public void testPositionTerminates() {
444436

445437
@Test
446438
public void testPositionMethod() throws Exception {
447-
assumeNotWindows(); // FIXME Make test case pass on Windows
448439
final Factory build = build(FooMethod.class);
449440
final CtClass<FooMethod> foo = build.Class().get(FooMethod.class);
450441
String classContent = getClassContent(foo);
@@ -515,7 +506,6 @@ public void testPositionMethod() throws Exception {
515506

516507
@Test
517508
public void testPositionAbstractMethod() throws Exception {
518-
assumeNotWindows(); // FIXME Make test case pass on Windows
519509
final Factory build = build(FooAbstractMethod.class);
520510
final CtClass<FooMethod> foo = build.Class().get(FooAbstractMethod.class);
521511
String classContent = getClassContent(foo);
@@ -550,7 +540,6 @@ public void testPositionAbstractMethod() throws Exception {
550540

551541
@Test
552542
public void testPositionStatement() throws Exception {
553-
assumeNotWindows(); // FIXME Make test case pass on Windows
554543
final Factory build = build(FooStatement.class);
555544
final CtType<FooStatement> foo = build.Type().get(FooStatement.class);
556545
String classContent = getClassContent(foo);
@@ -744,7 +733,6 @@ public void testPositionMethodTypeParameter() throws Exception {
744733

745734
@Test
746735
public void testPositionOfAnnonymousType() throws Exception {
747-
assumeNotWindows(); // FIXME Make test case pass on Windows
748736
//contract: the annonymous type has consistent position
749737
final CtEnum foo = (CtEnum) buildClass(SomeEnum.class);
750738
String classContent = getClassContent(foo);
@@ -929,7 +917,6 @@ public void testPositionTryCatch() throws Exception {
929917
}
930918
@Test
931919
public void testArrayArgParameter() throws Exception {
932-
assumeNotWindows(); // FIXME Make test case pass on Windows
933920
//contract: the parameter declared like `String arg[]`, `String[] arg` and `String []arg` has correct positions
934921
final CtType<?> foo = buildClass(ArrayArgParameter.class);
935922
String classContent = getClassContent(foo);
@@ -980,7 +967,6 @@ public void testArrayArgParameter() throws Exception {
980967

981968
@Test
982969
public void testExpressions() throws Exception {
983-
assumeNotWindows(); // FIXME Make test case pass on Windows
984970
//contract: the expression including type casts has correct position which includes all brackets too
985971
final CtType<?> foo = buildClass(Expressions.class);
986972
String classContent = getClassContent(foo);
@@ -1027,7 +1013,6 @@ public void testExpressions() throws Exception {
10271013
}
10281014
@Test
10291015
public void testCatchPosition() throws Exception {
1030-
assumeNotWindows(); // FIXME Make test case pass on Windows
10311016
//contract: check the catch position
10321017
final CtType<?> foo = buildClass(CatchPosition.class);
10331018
String classContent = getClassContent(foo);
@@ -1090,7 +1075,6 @@ public void testCatchPosition() throws Exception {
10901075
}
10911076
@Test
10921077
public void testEnumConstructorCallComment() throws Exception {
1093-
assumeNotWindows(); // FIXME Make test case pass on Windows
10941078
//contract: check position the enum constructor call
10951079
final CtType<?> foo = buildClass(FooEnum.class);
10961080

@@ -1108,7 +1092,6 @@ public void testEnumConstructorCallComment() throws Exception {
11081092
}
11091093
@Test
11101094
public void testSwitchCase() throws Exception {
1111-
assumeNotWindows(); // FIXME Make test case pass on Windows
11121095
//contract: check position of the statements of the case of switch
11131096
final CtType<?> foo = buildClass(FooSwitch.class);
11141097

@@ -1146,7 +1129,6 @@ public void testSwitchCase() throws Exception {
11461129
}
11471130
@Test
11481131
public void testFooForEach() throws Exception {
1149-
assumeNotWindows(); // FIXME Make test case pass on Windows
11501132
//contract: check position of the for each position
11511133
final CtType<?> foo = buildClass(FooForEach.class);
11521134

@@ -1288,7 +1270,6 @@ public void testPackageDeclarationPosition() throws Exception {
12881270

12891271
@Test
12901272
public void testImportPosition() throws Exception {
1291-
assumeNotWindows(); // FIXME Make test case pass on Windows
12921273
// contract: import position includes its comment
12931274
CtType<?> type = ModelUtils.buildClass(cfg -> {
12941275
cfg.getEnvironment().setCommentEnabled(true);
@@ -1306,7 +1287,6 @@ public void testImportPosition() throws Exception {
13061287

13071288
@Test
13081289
public void testPackageDeclarationWithCommentPosition() throws Exception {
1309-
assumeNotWindows(); // FIXME Make test case pass on Windows
13101290
// contract: package declaration position includes its comment. The file comment is not included
13111291
CtType<?> type = ModelUtils.buildClass(cfg -> {
13121292
cfg.getEnvironment().setCommentEnabled(true);

src/test/java/spoon/test/position/TestSourceFragment.java

-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import static org.junit.Assert.assertNull;
2121
import static org.junit.Assert.assertSame;
2222
import static org.junit.Assert.assertTrue;
23-
import static spoon.test.SpoonTestHelpers.assumeNotWindows;
2423

2524
import java.util.ArrayList;
2625
import java.util.Arrays;
@@ -213,7 +212,6 @@ public SourceFragment getOriginalSourceFragment() {
213212

214213
@Test
215214
public void testExactSourceFragments() throws Exception {
216-
assumeNotWindows(); // FIXME Make test case pass on Windows
217215
//contract: SourceFragments of some tricky sources are as expected
218216
final Launcher launcher = new Launcher();
219217
launcher.getEnvironment().setNoClasspath(false);
@@ -252,7 +250,6 @@ public void testExactSourceFragments() throws Exception {
252250

253251
@Test
254252
public void testSourceFragmentsOfCompilationUnit() throws Exception {
255-
assumeNotWindows(); // FIXME Make test case pass on Windows
256253
//contract: SourceFragments of compilation unit children like, package declaration, imports, types
257254
final Launcher launcher = new Launcher();
258255
launcher.getEnvironment().setNoClasspath(false);

src/test/java/spoon/test/prettyprinter/TestSniperPrinter.java

-18
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
import static org.junit.Assert.assertThrows;
7272
import static org.junit.Assert.assertTrue;
7373
import static org.junit.Assert.fail;
74-
import static spoon.test.SpoonTestHelpers.assumeNotWindows;
7574

7675
public class TestSniperPrinter {
7776

@@ -125,7 +124,6 @@ public void testClassRename(Consumer<CtType<?>> renameTransfo) throws Exception
125124

126125
@Test
127126
public void testPrintInsertedThrow() {
128-
assumeNotWindows(); // FIXME Make test case pass on Windows
129127
testSniper(Throw.class.getName(), type -> {
130128
CtConstructorCall<?> ctConstructorCall = (CtConstructorCall<?>) type.getMethodsByName("foo").get(0).getBody().getStatements().get(0);
131129
CtThrow ctThrow = type.getFactory().createCtThrow(ctConstructorCall.toString());
@@ -160,7 +158,6 @@ public void testPrintReplacementOfInvocation() {
160158

161159
@Test
162160
public void testPrintLocalVariableDeclaration() {
163-
assumeNotWindows(); // FIXME Make test case pass on Windows
164161
// contract: joint local declarations can be sniper-printed in whole unmodified method
165162
testSniper(OneLineMultipleVariableDeclaration.class.getName(), type -> {
166163
type.getFields().stream().forEach(x -> { x.delete(); });
@@ -179,7 +176,6 @@ public void testPrintLocalVariableDeclaration() {
179176

180177
@Test
181178
public void testPrintLocalVariableDeclaration2() {
182-
assumeNotWindows(); // FIXME Make test case pass on Windows
183179
// contract: joint local declarations can be sniper-printed
184180
testSniper(OneLineMultipleVariableDeclaration.class.getName(), type -> {
185181
type.getElements(new TypeFilter<>(CtLocalVariable.class)).get(0).delete();
@@ -199,7 +195,6 @@ public void testPrintLocalVariableDeclaration2() {
199195

200196
@Test
201197
public void testPrintOneLineMultipleVariableDeclaration() {
202-
assumeNotWindows(); // FIXME Make test case pass on Windows
203198
// contract: files with joint field declarations can be recompiled after sniper
204199
testSniper(OneLineMultipleVariableDeclaration.class.getName(), type -> {
205200
// we change something (anything would work)
@@ -238,7 +233,6 @@ public void testPrintAfterRenameOfField() {
238233

239234
@Test
240235
public void testPrintChangedComplex() {
241-
assumeNotWindows(); // FIXME Make test case pass on Windows
242236
//contract: sniper printing after remove of statement from nested complex `if else if ...`
243237
testSniper("spoon.test.prettyprinter.testclasses.ComplexClass", type -> {
244238
//find to be removed statement "bounds = false"
@@ -301,7 +295,6 @@ public void testPrintAfterRemoveOfLastParameter() {
301295

302296
@Test
303297
public void testPrintAfterRemoveOfLastTypeMember() {
304-
assumeNotWindows(); // FIXME Make test case pass on Windows
305298
//contract: sniper print after remove of last type member - check that suffix spaces are printed correctly
306299
testSniper(ToBeChanged.class.getName(), type -> {
307300
//delete first parameter of method `andSomeOtherMethod`
@@ -313,7 +306,6 @@ public void testPrintAfterRemoveOfLastTypeMember() {
313306

314307
@Test
315308
public void testPrintAfterAddOfLastTypeMember() {
316-
assumeNotWindows(); // FIXME Make test case pass on Windows
317309
//contract: sniper print after add of last type member - check that suffix spaces are printed correctly
318310
class Context {
319311
CtField<?> newField;
@@ -416,7 +408,6 @@ public void testCalculateCrashesWithInformativeMessageWhenSniperPrinterSetAfterM
416408

417409
@Test
418410
public void testWhitespacePrependedToFieldAddedAtTop() {
419-
assumeNotWindows(); // FIXME Make test case pass on Windows
420411
// contract: newline and indentation must be inserted before a field that's added to the top
421412
// of a class body when the class already has other type members.
422413

@@ -438,7 +429,6 @@ public void testWhitespacePrependedToFieldAddedAtTop() {
438429

439430
@Test
440431
public void testWhitespacePrependedToNestedClassAddedAtTop() {
441-
assumeNotWindows(); // FIXME Make test case pass on Windows
442432
// contract: newline and indentation must be inserted before a nested class that's added to
443433
// the top of a class body when the class already has other type members.
444434

@@ -458,7 +448,6 @@ public void testWhitespacePrependedToNestedClassAddedAtTop() {
458448

459449
@Test
460450
public void testWhitespacePrependedToLocalVariableAddAtTopOfNonEmptyMethod() {
461-
assumeNotWindows(); // FIXME Make test case pass on Windows
462451
// contract: newline and indentation must be inserted before a local variable that's added
463452
// to the top of a non-empty statement list.
464453

@@ -484,7 +473,6 @@ public void testWhitespacePrependedToLocalVariableAddAtTopOfNonEmptyMethod() {
484473

485474
@Test
486475
public void testNewlineInsertedBetweenCommentAndTypeMemberWithAddedModifier() {
487-
assumeNotWindows(); // FIXME Make test case pass on Windows
488476
// contract: newline must be inserted after comment when a succeeding type member has had a
489477
// modifier added to it
490478

@@ -505,7 +493,6 @@ public void testNewlineInsertedBetweenCommentAndTypeMemberWithAddedModifier() {
505493

506494
@Test
507495
public void testNewlineInsertedBetweenCommentAndTypeMemberWithRemovedModifier() {
508-
assumeNotWindows(); // FIXME Make test case pass on Windows
509496
// contract: newline must be inserted after comment when a succeeding field has had a
510497
// modifier removed from it
511498

@@ -526,7 +513,6 @@ public void testNewlineInsertedBetweenCommentAndTypeMemberWithRemovedModifier()
526513

527514
@Test
528515
public void testNewlineInsertedBetweenModifiedCommentAndTypeMemberWithAddedModifier() {
529-
assumeNotWindows(); // FIXME Make test case pass on Windows
530516
// contract: newline must be inserted after modified comment when a succeeding type member
531517
// has had its modifier list modified. We test modified comments separately from
532518
// non-modified comments as they are handled differently in the printer.
@@ -548,7 +534,6 @@ public void testNewlineInsertedBetweenModifiedCommentAndTypeMemberWithAddedModif
548534

549535
@Test
550536
public void testTypeMemberCommentDoesNotDisappearWhenAllModifiersAreRemoved() {
551-
assumeNotWindows(); // FIXME Make test case pass on Windows
552537
// contract: A comment on a field should not disappear when all of its modifiers are removed.
553538

554539
Consumer<CtType<?>> removeTypeMemberModifiers = type -> {
@@ -570,7 +555,6 @@ public void testTypeMemberCommentDoesNotDisappearWhenAllModifiersAreRemoved() {
570555

571556
@Test
572557
public void testAddedImportStatementPlacedOnSeparateLineInFileWithoutPackageStatement() {
573-
assumeNotWindows(); // FIXME Make test case pass on Windows
574558
// contract: newline must be inserted between import statements when a new one is added
575559

576560
Consumer<CtType<?>> addArrayListImport = type -> {
@@ -591,7 +575,6 @@ public void testAddedImportStatementPlacedOnSeparateLineInFileWithoutPackageStat
591575

592576
@Test
593577
public void testAddedImportStatementPlacedOnSeparateLineInFileWithPackageStatement() {
594-
assumeNotWindows(); // FIXME Make test case pass on Windows
595578
// contract: newline must be inserted both before and after a new import statement if ther
596579
// is a package statement in the file
597580

@@ -611,7 +594,6 @@ public void testAddedImportStatementPlacedOnSeparateLineInFileWithPackageStateme
611594

612595
@Test
613596
public void testAddedElementsIndentedWithAppropriateIndentationStyle() {
614-
assumeNotWindows(); // FIXME Make test case pass on Windows
615597
// contract: added elements in a source file should be indented with the same style of
616598
// indentation as in the rest of the file
617599

0 commit comments

Comments
 (0)