Adjusted the tesst in compiler.jx.tests to make use of the test-adapters introduced to compiler.tests
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/ea7610bd Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/ea7610bd Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/ea7610bd Branch: refs/heads/master Commit: ea7610bdad966a411e2b096e904069dfb260712f Parents: 3152e67 Author: Christofer Dutz <[email protected]> Authored: Sat Mar 12 12:57:46 2016 +0100 Committer: Christofer Dutz <[email protected]> Committed: Sat Mar 12 12:57:46 2016 +0100 ---------------------------------------------------------------------- compiler.jx.tests/build.xml | 5 ++ .../codegen/externals/ExternalsTestBase.java | 5 +- .../codegen/js/flexjs/TestFlexJSFile.java | 15 +++-- .../codegen/js/flexjs/TestFlexJSProject.java | 71 ++++++++++---------- .../codegen/js/goog/TestGoogProject.java | 26 ++++--- .../codegen/js/vf2js/TestVF2JSFile.java | 9 +-- .../codegen/js/vf2js/TestVF2JSProject.java | 13 ++-- .../mxml/vf2js/TestVF2JSMXMLApplication.java | 9 ++- .../compiler/internal/test/AMDTestBase.java | 4 +- .../flex/compiler/internal/test/TestBase.java | 23 +++---- .../internal/test/VF2JSMXMLTestBase.java | 6 +- 11 files changed, 97 insertions(+), 89 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ea7610bd/compiler.jx.tests/build.xml ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/build.xml b/compiler.jx.tests/build.xml index 83aa8ef..4f07725 100644 --- a/compiler.jx.tests/build.xml +++ b/compiler.jx.tests/build.xml @@ -48,6 +48,7 @@ <src path="${compiler.tests}/src"/> <compilerarg value="-Xlint:all,-path"/> <classpath> + <pathelement location="${compiler.tests}/../compiler.tests/classes"/> <fileset dir="${compiler}/lib" includes="**/*.jar"/> <fileset dir="${compiler.tests}/lib" includes="**/*.jar"/> </classpath> @@ -64,6 +65,7 @@ failureproperty="tests.unit.failed"> <classpath> <pathelement location="${compiler.tests}/classes"/> + <pathelement location="${compiler.tests}/../compiler.tests/classes"/> <fileset dir="${compiler}/lib" includes="**/*.jar"/> <fileset dir="${compiler.tests}/lib" includes="**/*.jar"/> </classpath> @@ -90,6 +92,7 @@ failureproperty="tests.unit.failed"> <classpath> <pathelement location="${compiler.tests}/classes"/> + <pathelement location="${compiler.tests}/../compiler.tests/classes"/> <fileset dir="${compiler}/lib" includes="**/*.jar"/> <fileset dir="${compiler.tests}/lib" includes="**/*.jar"/> </classpath> @@ -113,6 +116,7 @@ failureproperty="tests.unit.failed"> <classpath> <pathelement location="${compiler.tests}/classes"/> + <pathelement location="${compiler.tests}/../compiler.tests/classes"/> <fileset dir="${compiler}/lib" includes="**/*.jar"/> <fileset dir="${compiler.tests}/lib" includes="**/*.jar"/> </classpath> @@ -136,6 +140,7 @@ failureproperty="tests.unit.failed"> <classpath> <pathelement location="${compiler.tests}/classes"/> + <pathelement location="${compiler.tests}/../compiler.tests/classes"/> <fileset dir="${compiler}/lib" includes="**/*.jar"/> <fileset dir="${compiler.tests}/lib" includes="**/*.jar"/> </classpath> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ea7610bd/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestBase.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestBase.java index cfb088f..c1526c0 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestBase.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestBase.java @@ -28,7 +28,7 @@ import org.apache.flex.compiler.clients.EXTERNC; import org.apache.flex.compiler.clients.ExternCConfiguration; import org.apache.flex.compiler.internal.codegen.externals.reference.MethodReference; import org.apache.flex.compiler.internal.codegen.externals.reference.ReferenceModel; -import org.apache.flex.utils.FilenameNormalization; +import org.apache.flex.utils.TestAdapterFactory; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -38,7 +38,8 @@ import com.google.javascript.rhino.jstype.JSType; public abstract class ExternalsTestBase { - private static File unitTestBaseDir = new File(FilenameNormalization.normalize("test-files/externals_unit_tests")); + private static File unitTestBaseDir = + new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), "externals_unit_tests"); // Only used for testing, all configuration must happen in configure() protected ExternCConfiguration config; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ea7610bd/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFile.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFile.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFile.java index 892bddd..3e72c22 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFile.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFile.java @@ -27,6 +27,7 @@ import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration; import org.apache.flex.compiler.internal.projects.FlexJSProject; import org.apache.flex.compiler.internal.test.FlexJSTestBase; import org.apache.flex.compiler.tree.as.IFileNode; +import org.apache.flex.utils.TestAdapterFactory; import org.junit.Test; /** @@ -50,8 +51,8 @@ public class TestFlexJSFile extends FlexJSTestBase String fileName = "LocalFunction"; IFileNode node = compileAS(fileName, true, - "test-files" - + File.separator + "flexjs" + File.separator + "files", + new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + "flexjs/files").getPath(), false); asBlockWalker.visitFile(node); @@ -68,8 +69,8 @@ public class TestFlexJSFile extends FlexJSTestBase String fileName = "controllers/MyController"; IFileNode node = compileAS(fileName, true, - "test-files" - + File.separator + "flexjs" + File.separator + "files", + new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + "flexjs/files").getPath(), false); asBlockWalker.visitFile(node); @@ -85,8 +86,10 @@ public class TestFlexJSFile extends FlexJSTestBase { String fileName = "models/MyModel"; - IFileNode node = compileAS(fileName, true, "test-files" - + File.separator + "flexjs" + File.separator + "files", false); + IFileNode node = compileAS(fileName, true, + new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + "flexjs/files").getPath(), + false); asBlockWalker.visitFile(node); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ea7610bd/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java index 2b45164..a82736c 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java @@ -33,6 +33,7 @@ import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration; import org.apache.flex.compiler.internal.projects.FlexJSProject; import org.apache.flex.utils.FilenameNormalization; +import org.apache.flex.utils.TestAdapterFactory; import org.junit.Ignore; import org.junit.Test; @@ -71,8 +72,8 @@ public class TestFlexJSProject extends TestGoogProject String fileName = "Test"; - sourcePath = "test-files" - + File.separator + projectDirPath + "/interfaces"; + sourcePath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + projectDirPath + "/interfaces").getPath(); List<String> compiledFileNames = compileProject(fileName, testDirPath); @@ -86,9 +87,9 @@ public class TestFlexJSProject extends TestGoogProject String fileName = "Base"; - sourcePath = "test-files" - + File.separator + projectDirPath + "/super"; - + sourcePath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + projectDirPath + "/super").getPath(); + List<String> compiledFileNames = compileProject(fileName, testDirPath); assertProjectOut(compiledFileNames, testDirPath); @@ -101,9 +102,9 @@ public class TestFlexJSProject extends TestGoogProject String fileName = "MainClass"; - sourcePath = "test-files" - + File.separator + projectDirPath + "/internal"; - + sourcePath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + projectDirPath + "/internal").getPath(); + List<String> compiledFileNames = compileProject(fileName, testDirPath); assertProjectOut(compiledFileNames, testDirPath); @@ -116,9 +117,9 @@ public class TestFlexJSProject extends TestGoogProject String fileName = "Base"; - sourcePath = "test-files" - + File.separator + projectDirPath + "/circular"; - + sourcePath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + projectDirPath + "/circular").getPath(); + List<String> compiledFileNames = compileProject(fileName, testDirPath); assertProjectOut(compiledFileNames, testDirPath); @@ -132,10 +133,10 @@ public class TestFlexJSProject extends TestGoogProject String fileName = "AmbiguousDefinition"; externs.add("Event"); - - sourcePath = "test-files" - + File.separator + projectDirPath + "/package_conflicts_ambiguous_definition"; - + + sourcePath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + projectDirPath + "/package_conflicts_ambiguous_definition").getPath(); + StringBuilder sb = new StringBuilder(); compileProject(fileName, testDirPath, sb, false); @@ -155,10 +156,10 @@ public class TestFlexJSProject extends TestGoogProject String fileName = "SamePackageAsConflict"; externs.add("Event"); - - sourcePath = "test-files" - + File.separator + projectDirPath + "/package_conflicts_same_package_as_conflict"; - + + sourcePath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + projectDirPath + "/package_conflicts_same_package_as_conflict").getPath(); + List<String> compiledFileNames = compileProject(fileName, testDirPath); externs.clear(); @@ -174,10 +175,10 @@ public class TestFlexJSProject extends TestGoogProject String fileName = "DifferentPackageAsConflict"; externs.add("Event"); - - sourcePath = "test-files" - + File.separator + projectDirPath + "/package_conflicts_different_package_as_conflict"; - + + sourcePath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + projectDirPath + "/package_conflicts_different_package_as_conflict").getPath(); + List<String> compiledFileNames = compileProject(fileName, testDirPath); externs.clear(); @@ -193,10 +194,10 @@ public class TestFlexJSProject extends TestGoogProject String fileName = "UseWindow"; externs.add("Event"); - - sourcePath = "test-files" - + File.separator + projectDirPath + "/package_conflicts_use_window"; - + + sourcePath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + projectDirPath + "/package_conflicts_use_window").getPath(); + List<String> compiledFileNames = compileProject(fileName, testDirPath); externs.clear(); @@ -212,10 +213,10 @@ public class TestFlexJSProject extends TestGoogProject String fileName = "NoConflictNoWindow"; externs.add("Event"); - - sourcePath = "test-files" - + File.separator + projectDirPath + "/package_conflicts_no_conflict_no_window"; - + + sourcePath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + projectDirPath + "/package_conflicts_no_conflict_no_window").getPath(); + List<String> compiledFileNames = compileProject(fileName, testDirPath); externs.clear(); @@ -231,10 +232,10 @@ public class TestFlexJSProject extends TestGoogProject String fileName = "NoConflictUseWindow"; externs.add("Event"); - - sourcePath = "test-files" - + File.separator + projectDirPath + "/package_conflicts_no_conflict_use_window"; - + + sourcePath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + projectDirPath + "/package_conflicts_no_conflict_use_window").getPath(); + List<String> compiledFileNames = compileProject(fileName, testDirPath); externs.clear(); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ea7610bd/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogProject.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogProject.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogProject.java index 5339554..c79e967 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogProject.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogProject.java @@ -19,18 +19,18 @@ package org.apache.flex.compiler.internal.codegen.js.goog; -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; - -import java.io.File; -import java.util.List; - import org.apache.flex.compiler.driver.IBackend; import org.apache.flex.compiler.internal.driver.js.goog.GoogBackend; import org.apache.flex.compiler.internal.test.ASTestBase; -import org.apache.flex.utils.FilenameNormalization; +import org.apache.flex.utils.TestAdapterFactory; import org.junit.Test; +import java.io.File; +import java.util.List; + +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertThat; + /** * This class tests the production of valid 'goog' JS code from an external * project. @@ -57,8 +57,8 @@ public class TestGoogProject extends ASTestBase @Override protected void addSourcePaths(List<File> sourcePaths) { - sourcePaths.add(new File(FilenameNormalization.normalize("test-files" - + File.separator + projectDirPath + "/imports"))); + sourcePaths.add(new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + projectDirPath + "/imports")); super.addSourcePaths(sourcePaths); } @@ -86,11 +86,9 @@ public class TestGoogProject extends ASTestBase String compiledResult = readCodeFile(new File(compiledFilePath)); //System.out.println(compiledResult); - - String expectedFilePath = new File("test-files").getAbsolutePath() - + File.separator + testDirPath + File.separator - + compiledFileName + "_result" + "." - + backend.getOutputExtension(); + + String expectedFilePath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + testDirPath + "/" + compiledFileName + "_result" + "." + backend.getOutputExtension()).getPath(); String expectedResult = readCodeFile(new File(expectedFilePath)); assertThat(compiledResult, is(expectedResult)); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ea7610bd/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java index 56bb290..5c1c913 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java @@ -27,6 +27,7 @@ import org.apache.flex.compiler.internal.driver.js.vf2js.VF2JSBackend; import org.apache.flex.compiler.internal.test.VF2JSTestBase; import org.apache.flex.compiler.tree.as.IFileNode; import org.apache.flex.utils.FilenameNormalization; +import org.apache.flex.utils.TestAdapterFactory; import org.junit.Ignore; import org.junit.Test; @@ -45,8 +46,8 @@ public class TestVF2JSFile extends VF2JSTestBase String fileName = "SimpleAS"; IFileNode node = compileAS(fileName, true, - "test-files" - + File.separator + "vf2js" + File.separator + "files", + new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + "vf2js/files").getPath(), false); asBlockWalker.visitFile(node); @@ -63,8 +64,8 @@ public class TestVF2JSFile extends VF2JSTestBase String fileName = "Version"; IFileNode node = compileAS(fileName, true, - "test-files" - + File.separator + "vf2js" + File.separator + "files", + new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + "vf2js/files").getPath(), false); asBlockWalker.visitFile(node); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ea7610bd/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java index d7711d7..ebab98c 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java @@ -27,6 +27,7 @@ import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogProject; import org.apache.flex.compiler.internal.driver.js.vf2js.VF2JSBackend; import org.apache.flex.compiler.internal.projects.FlexJSProject; import org.apache.flex.utils.FilenameNormalization; +import org.apache.flex.utils.TestAdapterFactory; import org.junit.Ignore; import org.junit.Test; @@ -95,14 +96,14 @@ public class TestVF2JSProject extends TestGoogProject @Override protected void addSourcePaths(List<File> sourcePaths) { - sourcePaths.add(new File(FilenameNormalization.normalize("test-files" - + File.separator + projectDirPath + "/interfaces"))); + sourcePaths.add(new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + projectDirPath + "/interfaces")); - sourcePaths.add(new File(FilenameNormalization.normalize("test-files" - + File.separator + projectDirPath + "/sdk"))); + sourcePaths.add(new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + projectDirPath + "/sdk")); - sourcePaths.add(new File(FilenameNormalization.normalize("test-files" - + File.separator + projectDirPath + "/super"))); + sourcePaths.add(new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + projectDirPath + "/super")); super.addSourcePaths(sourcePaths); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ea7610bd/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/TestVF2JSMXMLApplication.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/TestVF2JSMXMLApplication.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/TestVF2JSMXMLApplication.java index 086b554..2a5d268 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/TestVF2JSMXMLApplication.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/TestVF2JSMXMLApplication.java @@ -27,6 +27,7 @@ import java.util.List; import org.apache.flex.compiler.internal.test.VF2JSMXMLTestBase; import org.apache.flex.compiler.tree.mxml.IMXMLFileNode; import org.apache.flex.utils.FilenameNormalization; +import org.apache.flex.utils.TestAdapterFactory; import org.junit.Test; public class TestVF2JSMXMLApplication extends VF2JSMXMLTestBase @@ -84,11 +85,9 @@ public class TestVF2JSMXMLApplication extends VF2JSMXMLTestBase String compiledResult = readCodeFile(new File(compiledFilePath)); //System.out.println(compiledResult); - - String expectedFilePath = new File("test-files").getAbsolutePath() - + File.separator + testDirPath + File.separator - + compiledFileName + "_result" + "." - + backend.getOutputExtension(); + + String expectedFilePath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + testDirPath + "/" + compiledFileName + "_result" + "." + backend.getOutputExtension()).getPath(); String expectedResult = readCodeFile(new File(expectedFilePath)); assertThat(compiledResult, is(expectedResult)); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ea7610bd/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/AMDTestBase.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/AMDTestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/AMDTestBase.java index 3728b06..faa7ea0 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/AMDTestBase.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/AMDTestBase.java @@ -34,6 +34,7 @@ import org.apache.flex.compiler.tree.as.ISetterNode; import org.apache.flex.compiler.tree.as.ITypeNode; import org.apache.flex.compiler.tree.as.IVariableNode; import org.apache.flex.utils.FilenameNormalization; +import org.apache.flex.utils.TestAdapterFactory; /** * This class tests the production of AMD JavaScript for AS package. @@ -58,7 +59,8 @@ public abstract class AMDTestBase extends TestBase asEmitter = backend.createEmitter(writer); asBlockWalker = backend.createWalker(project, errors, asEmitter); - projectPath = "test-files/amd/simple-project/src"; + projectPath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + "amd/simple-project/src").getPath(); String target = getTypeUnderTest().replace(".", File.separator); String targetDir = projectPath + File.separator http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ea7610bd/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java index f54a8cd..d51e7ec 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java @@ -64,6 +64,7 @@ import org.apache.flex.utils.EnvProperties; import org.apache.flex.compiler.visitor.as.IASBlockWalker; import org.apache.flex.compiler.visitor.mxml.IMXMLBlockWalker; import org.apache.flex.utils.FilenameNormalization; +import org.apache.flex.utils.TestAdapterFactory; import org.junit.After; import org.junit.Before; import org.junit.Ignore; @@ -134,7 +135,7 @@ public class TestBase implements ITestBase libraries = new ArrayList<File>(); namespaceMappings = new ArrayList<IMXMLNamespaceMapping>(); - tempDir = new File(FilenameNormalization.normalize("temp")); // ensure this exists + tempDir = new File(TestAdapterFactory.getTestAdapter().getTempDir()); // ensure this exists } @After @@ -215,9 +216,8 @@ public class TestBase implements ITestBase protected IASNode compile(String input, boolean isFileName, String inputDir, boolean useTempFile) { - File tempFile = (useTempFile) ? writeCodeToTempFile(input, isFileName, - inputDir) : new File(FilenameNormalization.normalize(inputDir - + File.separator + input + inputFileExtension)); + File tempFile = (useTempFile) ? writeCodeToTempFile(input, isFileName, inputDir) : + new File(inputDir + "/" + input + inputFileExtension); addDependencies(); @@ -258,9 +258,8 @@ public class TestBase implements ITestBase { List<String> compiledFileNames = new ArrayList<String>(); - String mainFileName = "test-files" - + File.separator + inputDirName + File.separator - + inputFileName + inputFileExtension; + String mainFileName = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + inputDirName + "/" + inputFileName + inputFileExtension).getPath(); addDependencies(); @@ -473,7 +472,7 @@ public class TestBase implements ITestBase .getSimpleName(); tempASFile = File.createTempFile(tempFileName, inputFileExtension, - tempDir); + new File(TestAdapterFactory.getTestAdapter().getTempDir())); tempASFile.deleteOnExit(); String code = ""; @@ -559,11 +558,9 @@ public class TestBase implements ITestBase protected String getCodeFromFile(String fileName, boolean isJS, String sourceDir) { - String testFileDir = FilenameNormalization.normalize("test-files"); - - File testFile = new File(testFileDir - + File.separator + sourceDir + File.separator + fileName - + (isJS ? ".js" : inputFileExtension)); + File testFile = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + sourceDir + "/" + fileName + + (isJS ? ".js" : inputFileExtension)); return readCodeFile(testFile); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ea7610bd/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSMXMLTestBase.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSMXMLTestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSMXMLTestBase.java index 37b40e9..a421d5e 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSMXMLTestBase.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSMXMLTestBase.java @@ -36,6 +36,7 @@ import org.apache.flex.compiler.tree.mxml.IMXMLFileNode; import org.apache.flex.compiler.tree.mxml.IMXMLNode; import org.apache.flex.compiler.units.ICompilationUnit; import org.apache.flex.utils.FilenameNormalization; +import org.apache.flex.utils.TestAdapterFactory; import org.junit.Ignore; import com.google.common.collect.ImmutableSet; @@ -66,9 +67,8 @@ public class VF2JSMXMLTestBase extends MXMLTestBase { List<String> compiledFileNames = new ArrayList<String>(); - String mainFileName = "test-files" - + File.separator + inputDirName + File.separator - + inputFileName + inputFileExtension; + String mainFileName = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + inputDirName + "/" + inputFileName + inputFileExtension).getPath(); addDependencies();
