From f3623cc56e6b6bf03164e1b5cd03a31be5bacd47 Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Sun, 3 Mar 2019 19:00:45 -0800 Subject: [PATCH] windows compatibility in tests --- testing/src/test/java/org/aspectj/testing/FileSpec.java | 5 ++++- .../incremental/tools/AnnotationProcessingTests.java | 8 ++++---- .../incremental/tools/MultiProjectIncrementalTests.java | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/testing/src/test/java/org/aspectj/testing/FileSpec.java b/testing/src/test/java/org/aspectj/testing/FileSpec.java index 2164f38f1..cd11e4026 100644 --- a/testing/src/test/java/org/aspectj/testing/FileSpec.java +++ b/testing/src/test/java/org/aspectj/testing/FileSpec.java @@ -55,7 +55,10 @@ public class FileSpec implements ITestStep { if (toDelete != null) { File targetForDeletion = new File(sandbox, toDelete); if (targetForDeletion.isFile()) { - targetForDeletion.delete(); + boolean b = targetForDeletion.delete(); + if (!b) { + throw new IllegalStateException("Failed to delete "+targetForDeletion); + } } else { recursiveDelete(targetForDeletion); } diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AnnotationProcessingTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AnnotationProcessingTests.java index 78d671946..80434fa5c 100644 --- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AnnotationProcessingTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AnnotationProcessingTests.java @@ -56,7 +56,7 @@ public class AnnotationProcessingTests extends AbstractMultiProjectIncrementalAj checkCompiledFiles("ProcessorConsumer1","Advise_ccc.java","Advise_aaa.java","Code.java"); assertEquals(2,getWeavingMessages("ProcessorConsumer1").size()); String out = runMethod("ProcessorConsumer1", "Code", "runner"); - assertEquals("aaa running\nccc running\n",out); + assertEquals("aaa running\nccc running\n",out.replace("\r","")); } // services file in processor project @@ -84,7 +84,7 @@ public class AnnotationProcessingTests extends AbstractMultiProjectIncrementalAj checkCompiledFiles("ProcessorConsumer2","Advise_ccc.java","Advise_aaa.java","Code.java"); assertEquals(2,getWeavingMessages("ProcessorConsumer2").size()); String out = runMethod("ProcessorConsumer2", "Code", "runner"); - assertEquals("aaa running\nccc running\n",out); + assertEquals("aaa running\nccc running\n",out.replace("\r","")); } // Two processors @@ -122,7 +122,7 @@ public class AnnotationProcessingTests extends AbstractMultiProjectIncrementalAj checkCompiledFiles("ProcessorConsumer1","Advise_ccc.java","Advise_aaa.java","Code.java","AroundAdvise_ccc.java","AroundAdvise_aaa.java"); assertEquals(4,getWeavingMessages("ProcessorConsumer1").size()); String out = runMethod("ProcessorConsumer1", "Code", "runner"); - assertEquals("aaa running\nAround advice on aaa running\nccc running\nAround advice on ccc running\n",out); + assertEquals("aaa running\nAround advice on aaa running\nccc running\nAround advice on ccc running\n",out.replace("\r","")); } // Tests: @@ -151,7 +151,7 @@ public class AnnotationProcessingTests extends AbstractMultiProjectIncrementalAj for (String expectedCompiledFile: expectedCompiledFiles) { String toRemove = null; for (String compiledFile: compiledFiles) { - String cfile = compiledFile.substring(compiledFile.lastIndexOf("/")+1); + String cfile = compiledFile.substring(compiledFile.lastIndexOf(File.separator)+1); if (cfile.equals(expectedCompiledFile)) { toRemove = compiledFile; break; diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index 779143bd1..0d01d9634 100644 --- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -3579,11 +3579,11 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa initialiseProject("456801"); build("456801"); String output = runMethod("456801", "Code", "run"); - assertEquals("advice runnning\nrun() running\n",output); + assertEquals("advice runnning\nrun() running\n",output.replace("\r","")); alter("456801", "inc1"); build("456801"); output = runMethod("456801", "Code", "run"); - assertEquals("advice running\nrun() running\n",output); + assertEquals("advice running\nrun() running\n",output.replace("\r","")); checkCompileWeaveCount("456801", 1, 1); checkWasntFullBuild(); } -- 2.39.5