Repository: flex-falcon Updated Branches: refs/heads/develop 6541ded7d -> a5b8b0f8a
- Continued making the Unit-Tests use the TestAdapters - Fixed and re-enabled the TestExternJQuery test Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/a5b8b0f8 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/a5b8b0f8 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/a5b8b0f8 Branch: refs/heads/develop Commit: a5b8b0f8ac7a31fe7d6a9d58b427053bac33f90f Parents: 6541ded Author: Christofer Dutz <[email protected]> Authored: Tue Mar 22 23:18:13 2016 +0100 Committer: Christofer Dutz <[email protected]> Committed: Tue Mar 22 23:18:13 2016 +0100 ---------------------------------------------------------------------- .../codegen/externals/ExternalsTestUtils.java | 3 +++ .../codegen/externals/TestExternJQuery.java | 4 +--- .../externals/TestExternalsJSCompile.java | 16 +++++++------- .../codegen/js/flexjs/TestFlexJSProject.java | 13 +++++++---- .../codegen/js/vf2js/TestVF2JSFile.java | 14 ++++++------ .../mxml/flexjs/TestFlexJSMXMLApplication.java | 23 ++++++++++++-------- .../mxml/vf2js/TestVF2JSMXMLApplication.java | 8 ++++--- .../compiler/internal/test/FlexJSTestBase.java | 5 ++++- .../compiler/internal/test/VF2JSTestBase.java | 8 ++++--- .../org/apache/flex/utils/AntTestAdapter.java | 2 +- 10 files changed, 57 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a5b8b0f8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestUtils.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestUtils.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestUtils.java index 2c27ee7..7956e25 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestUtils.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestUtils.java @@ -41,6 +41,9 @@ public class ExternalsTestUtils public static File EXTERNAL_JS_DIR = FilenameNormalization.normalize(new File( "../externs/js/externs")); + public static File EXTERNAL_JQUERY_DIR = FilenameNormalization.normalize(new File( + "../externs/jquery/externs")); + public static File EXTERNAL_JASMINE_DIR = FilenameNormalization.normalize(new File( "../externs/jasmine/externs")); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a5b8b0f8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestExternJQuery.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestExternJQuery.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestExternJQuery.java index bbb41f9..7a2c1d0 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestExternJQuery.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestExternJQuery.java @@ -26,12 +26,10 @@ import java.io.IOException; import org.apache.flex.compiler.clients.ExternCConfiguration; import org.apache.flex.compiler.internal.codegen.externals.reference.ClassReference; -import org.junit.Ignore; import org.junit.Test; import com.google.javascript.jscomp.Result; -@Ignore public class TestExternJQuery extends ExternalsTestBase { @SuppressWarnings("unused") @@ -62,7 +60,7 @@ public class TestExternJQuery extends ExternalsTestBase { config.setASRoot(ExternalsTestUtils.AS_ROOT_DIR); - String coreRoot = ExternalsTestUtils.EXTERNAL_JS_DIR.getAbsolutePath(); + String coreRoot = ExternalsTestUtils.EXTERNAL_JQUERY_DIR.getAbsolutePath(); config.addExternal(coreRoot + "/jquery-1.9.js"); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a5b8b0f8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestExternalsJSCompile.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestExternalsJSCompile.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestExternalsJSCompile.java index 3d12ad1..feff678 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestExternalsJSCompile.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestExternalsJSCompile.java @@ -44,6 +44,8 @@ import org.apache.flex.compiler.problems.ICompilerProblem; import org.apache.flex.compiler.units.ICompilationUnit; import org.apache.flex.compiler.visitor.as.IASBlockWalker; import org.apache.flex.utils.FilenameNormalization; +import org.apache.flex.utils.ITestAdapter; +import org.apache.flex.utils.TestAdapterFactory; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -53,17 +55,15 @@ import com.google.common.collect.Iterables; public class TestExternalsJSCompile { - private static File tempDir = new File( - FilenameNormalization.normalize("temp")); + private static ITestAdapter testAdapter = TestAdapterFactory.getTestAdapter(); - private static File app1ASSrcDir = new File( - FilenameNormalization.normalize("test-files/externals/app1/as_src")); + private static File tempDir = new File(testAdapter.getTempDir()); - private static File app1AJSSrcDir = new File( - FilenameNormalization.normalize("temp/externals/app1/js_src")); + private static File app1ASSrcDir = new File(testAdapter.getUnitTestBaseDir(), "externals/app1/as_src"); - private static File jsSWCFile = new File( - FilenameNormalization.normalize("temp/externals/bin/JS.swc")); + private static File app1AJSSrcDir = new File(testAdapter.getTempDir(), "externals/app1/js_src"); + + private static File jsSWCFile = new File(testAdapter.getTempDir(), "externals/bin/JS.swc"); protected static Workspace workspace = new Workspace(); protected FlexJSProject project; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a5b8b0f8/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 7a739c1..b20d8f5 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 @@ -35,6 +35,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.ITestAdapter; import org.apache.flex.utils.TestAdapterFactory; import org.junit.Ignore; import org.junit.Test; @@ -47,10 +48,11 @@ import org.junit.Test; */ public class TestFlexJSProject extends TestGoogProject { + private static ITestAdapter testAdapter = TestAdapterFactory.getTestAdapter(); private static String projectDirPath = "flexjs/projects"; - protected String sourcePath; - protected Collection<String> externs = new ArrayList<String>(); + private String sourcePath; + private Collection<String> externs = new ArrayList<String>(); @Override public void setUp() @@ -205,8 +207,11 @@ public class TestFlexJSProject extends TestGoogProject String out = sb.toString(); out = out.replace("\\", "/"); - - assertThat(out, is("test-files/flexjs/projects/package_conflicts_ambiguous_definition/mypackage/TestClass.as(29:20)\nAmbiguous reference to Event\ntest-files/flexjs/projects/package_conflicts_ambiguous_definition/mypackage/TestClass.as(30:41)\nAmbiguous reference to Event\n")); + + assertThat(out, is(testAdapter.getUnitTestBaseDir().getPath() + + "/flexjs/projects/package_conflicts_ambiguous_definition/mypackage/TestClass.as(29:20)\nAmbiguous reference to Event\n" + + testAdapter.getUnitTestBaseDir().getPath() + + "/flexjs/projects/package_conflicts_ambiguous_definition/mypackage/TestClass.as(30:41)\nAmbiguous reference to Event\n")); } @Test http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a5b8b0f8/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 5c1c913..eaa79d3 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 @@ -26,7 +26,7 @@ import org.apache.flex.compiler.driver.IBackend; 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.ITestAdapter; import org.apache.flex.utils.TestAdapterFactory; import org.junit.Ignore; import org.junit.Test; @@ -39,15 +39,16 @@ import org.junit.Test; */ public class TestVF2JSFile extends VF2JSTestBase { - @Ignore + private static ITestAdapter testAdapter = TestAdapterFactory.getTestAdapter(); + + @Ignore @Test public void testSimple() { String fileName = "SimpleAS"; IFileNode node = compileAS(fileName, true, - new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), - "vf2js/files").getPath(), + new File(testAdapter.getUnitTestBaseDir(), "vf2js/files").getPath(), false); asBlockWalker.visitFile(node); @@ -64,8 +65,7 @@ public class TestVF2JSFile extends VF2JSTestBase String fileName = "Version"; IFileNode node = compileAS(fileName, true, - new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), - "vf2js/files").getPath(), + new File(testAdapter.getUnitTestBaseDir(), "vf2js/files").getPath(), false); asBlockWalker.visitFile(node); @@ -79,7 +79,7 @@ public class TestVF2JSFile extends VF2JSTestBase @Override protected void addSourcePaths(List<File> sourcePaths) { - sourcePaths.add(new File(FilenameNormalization.normalize("test-files/vf2js/files"))); + sourcePaths.add(new File(testAdapter.getUnitTestBaseDir(), "vf2js/files")); super.addSourcePaths(sourcePaths); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a5b8b0f8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java index 474f496..fc5ce66 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java @@ -24,11 +24,16 @@ import org.apache.flex.compiler.internal.projects.FlexJSProject; import org.apache.flex.compiler.internal.test.FlexJSTestBase; import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode; import org.apache.flex.compiler.tree.mxml.IMXMLFileNode; -import org.apache.flex.compiler.tree.mxml.IMXMLScriptNode; +import org.apache.flex.utils.ITestAdapter; +import org.apache.flex.utils.TestAdapterFactory; import org.junit.Test; +import java.io.File; + public class TestFlexJSMXMLApplication extends FlexJSTestBase { + private static ITestAdapter testAdapter = TestAdapterFactory.getTestAdapter(); + @Override public void setUp() { @@ -42,7 +47,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase String fileName = "wildcard_import"; IMXMLFileNode node = compileMXML(fileName, true, - "test-files/flexjs/files", false); + new File(testAdapter.getUnitTestBaseDir(), "flexjs/files").getPath(), false); mxmlBlockWalker.visitFile(node); @@ -57,7 +62,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase String fileName = "FlexJSTest_again"; IMXMLFileNode node = compileMXML(fileName, true, - "test-files/flexjs/files", false); + new File(testAdapter.getUnitTestBaseDir(), "flexjs/files").getPath(), false); mxmlBlockWalker.visitFile(node); @@ -72,7 +77,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase String fileName = "MyInitialView"; IMXMLFileNode node = compileMXML(fileName, true, - "test-files/flexjs/files", false); + new File(testAdapter.getUnitTestBaseDir(), "flexjs/files").getPath(), false); mxmlBlockWalker.visitFile(node); @@ -80,7 +85,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase assertOutWithMetadata(getCodeFromFile(fileName + "_result", true, "flexjs/files")); } - + @Test public void testInterfaceAttribute() { @@ -156,7 +161,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase " return {\n" + " variables: function () {\n" + " return {\n" + - " };\n" + + " };\n" + " },\n" + " accessors: function () {\n" + " return {\n" + @@ -171,7 +176,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase "\n" + "\n" + "\n"; - + assertOutWithMetadata(outTemplate.replaceAll("AppName", appName)); } @@ -252,7 +257,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase " return {\n" + " variables: function () {\n" + " return {\n" + - " };\n" + + " };\n" + " },\n" + " accessors: function () {\n" + " return {\n" + @@ -267,7 +272,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase "\n" + "\n" + "\n"; - + assertOutWithMetadata(outTemplate.replaceAll("AppName", appName)); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a5b8b0f8/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 2a5d268..72bbc3d 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,17 +27,19 @@ 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.ITestAdapter; import org.apache.flex.utils.TestAdapterFactory; import org.junit.Test; public class TestVF2JSMXMLApplication extends VF2JSMXMLTestBase { + private static ITestAdapter testAdapter = TestAdapterFactory.getTestAdapter(); @Override protected void addSourcePaths(List<File> sourcePaths) { - sourcePaths.add(new File(FilenameNormalization.normalize("test-files/vf2js/files"))); - sourcePaths.add(new File(FilenameNormalization.normalize("test-files/vf2js/projects/simpleMXML/src"))); + sourcePaths.add(new File(testAdapter.getUnitTestBaseDir(), "vf2js/files")); + sourcePaths.add(new File(testAdapter.getUnitTestBaseDir(), "vf2js/projects/simpleMXML/src")); super.addSourcePaths(sourcePaths); } @@ -48,7 +50,7 @@ public class TestVF2JSMXMLApplication extends VF2JSMXMLTestBase String fileName = "SimpleMXML"; IMXMLFileNode node = compileMXML(fileName, true, - "test-files/vf2js/files", false); + new File(testAdapter.getUnitTestBaseDir(), "vf2js/files").getPath(), false); mxmlBlockWalker.visitFile(node); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a5b8b0f8/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java index e1c5056..203d16a 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java @@ -29,11 +29,14 @@ import org.apache.flex.compiler.mxml.IMXMLNamespaceMapping; import org.apache.flex.compiler.tree.mxml.IMXMLFileNode; import org.apache.flex.compiler.tree.mxml.IMXMLNode; import org.apache.flex.utils.FilenameNormalization; +import org.apache.flex.utils.ITestAdapter; +import org.apache.flex.utils.TestAdapterFactory; import org.junit.Ignore; @Ignore public class FlexJSTestBase extends TestBase { + protected static ITestAdapter testAdapter = TestAdapterFactory.getTestAdapter(); @Override public void setUp() @@ -83,7 +86,7 @@ public class FlexJSTestBase extends TestBase protected void addSourcePaths(List<File> sourcePaths) { sourcePaths.add(new File(env.ASJS + "/examples/FlexJSTest_basic/src")); - sourcePaths.add(new File(FilenameNormalization.normalize("test-files/flexjs/files"))); + sourcePaths.add(new File(testAdapter.getUnitTestBaseDir(), "flexjs/files")); super.addSourcePaths(sourcePaths); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a5b8b0f8/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSTestBase.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSTestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSTestBase.java index 3fee7eb..f6cbf58 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSTestBase.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSTestBase.java @@ -36,6 +36,8 @@ 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.ITestAdapter; +import org.apache.flex.utils.TestAdapterFactory; import org.junit.Ignore; import com.google.common.collect.ImmutableSet; @@ -44,6 +46,7 @@ import com.google.common.collect.Iterables; @Ignore public class VF2JSTestBase extends MXMLTestBase { + private static ITestAdapter testAdapter = TestAdapterFactory.getTestAdapter(); @Override public void setUp() @@ -84,9 +87,8 @@ public class VF2JSTestBase extends MXMLTestBase { List<String> compiledFileNames = new ArrayList<String>(); - String mainFileName = "test-files" - + File.separator + inputDirName + File.separator - + inputFileName + inputFileExtension; + String mainFileName = new File(testAdapter.getUnitTestBaseDir(), + inputDirName + "/" + inputFileName + inputFileExtension).getPath(); addDependencies(); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a5b8b0f8/compiler.tests/src/org/apache/flex/utils/AntTestAdapter.java ---------------------------------------------------------------------- diff --git a/compiler.tests/src/org/apache/flex/utils/AntTestAdapter.java b/compiler.tests/src/org/apache/flex/utils/AntTestAdapter.java index c79c61a..cd3cb4f 100644 --- a/compiler.tests/src/org/apache/flex/utils/AntTestAdapter.java +++ b/compiler.tests/src/org/apache/flex/utils/AntTestAdapter.java @@ -101,7 +101,7 @@ public class AntTestAdapter implements ITestAdapter { @Override public File getUnitTestBaseDir() { - return new File(FilenameNormalization.normalize("test-files")); + return new File("test-files"); } private File getLib(String artifactId) {
