]> source.dussan.org Git - aspectj.git/commitdiff
windows compatibility in tests
authorAndy Clement <aclement@pivotal.io>
Mon, 4 Mar 2019 03:00:45 +0000 (19:00 -0800)
committerAndy Clement <aclement@pivotal.io>
Mon, 4 Mar 2019 03:00:45 +0000 (19:00 -0800)
testing/src/test/java/org/aspectj/testing/FileSpec.java
tests/src/test/java/org/aspectj/systemtest/incremental/tools/AnnotationProcessingTests.java
tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

index 2164f38f117b6e6594067d4165b8b7075eb08ce4..cd11e40263eaf085095c7183401472f472f5bf48 100644 (file)
@@ -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);
                        }
index 78d671946adac81bb44e87b0557350a10e1de371..80434fa5c536be7d0229c3a2b8dd81b1e2457fdd 100644 (file)
@@ -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;
index 779143bd1fbf484e065568d3ef7558539617e434..0d01d9634e237ae167893f161f6fd543850809a0 100644 (file)
@@ -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();
        }