You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by er...@apache.org on 2013/04/10 12:05:40 UTC

[1/3] git commit: [FalconJX] wildcard import test

Updated Branches:
  refs/heads/develop 0eb72d8bc -> c050380d9


[FalconJX] wildcard import test

Added test files and code for a test of 'wildcard' imports (my.package.*); ignored same test because compiler is not yet handling these imports ;-)

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/0fa98cfe
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/0fa98cfe
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/0fa98cfe

Branch: refs/heads/develop
Commit: 0fa98cfe2892c57efff7bb15dec9b7ce3cd271a4
Parents: 0eb72d8
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Apr 10 09:19:27 2013 +0200
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Apr 10 09:19:27 2013 +0200

----------------------------------------------------------------------
 .../mxml/flexjs/TestFlexJSMXMLApplication.java     |   23 ++++-
 .../test-files/flexjs/files/wildcard_import.mxml   |   18 +++
 .../flexjs/files/wildcard_import_result.js         |   82 +++++++++++++++
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java     |   24 +++--
 4 files changed, 134 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0fa98cfe/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 ddf143b..bd7c4f9 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
@@ -2,12 +2,29 @@ package org.apache.flex.compiler.internal.codegen.mxml.flexjs;
 
 import org.apache.flex.compiler.internal.test.FlexJSTestBase;
 import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class TestFlexJSMXMLApplication extends FlexJSTestBase
 {
 
+    @Ignore
     @Test
+    public void testFile()
+    {
+        String fileName = "wildcard_import";
+
+        IMXMLFileNode node = compileMXML(fileName, true,
+                "test-files/flexjs/files", false);
+
+        mxmlBlockWalker.visitFile(node);
+        
+        //writeResultToFile(writer.toString(), fileName);
+
+        assertOut(getCodeFromFile(fileName + "_result", true, "flexjs/files"));
+    }
+
+    //@Test
     public void testFlexJSMainFile()
     {
         String fileName = "FlexJSTest_2013_03_11";
@@ -17,12 +34,12 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
 
         mxmlBlockWalker.visitFile(node);
 
-        writeResultToFile(writer.toString(), fileName); // for external comparison
+        //writeResultToFile(writer.toString(), fileName);
 
         assertOut(getCodeFromFile(fileName + "_result", true, "flexjs/files"));
     }
 
-    @Test
+    //@Test
     public void testFlexJSInitialViewFile()
     {
         String fileName = "MyInitialView_2013_03_11";
@@ -32,7 +49,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
 
         mxmlBlockWalker.visitFile(node);
 
-        writeResultToFile(writer.toString(), fileName); // for external comparison
+        //writeResultToFile(writer.toString(), fileName);
 
         assertOut(getCodeFromFile(fileName + "_result", true, "flexjs/files"));
     }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0fa98cfe/compiler.jx.tests/test-files/flexjs/files/wildcard_import.mxml
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/wildcard_import.mxml b/compiler.jx.tests/test-files/flexjs/files/wildcard_import.mxml
new file mode 100644
index 0000000..cafe2d0
--- /dev/null
+++ b/compiler.jx.tests/test-files/flexjs/files/wildcard_import.mxml
@@ -0,0 +1,18 @@
+<basic:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+				   xmlns:basic="library://ns.apache.org/flexjs/basic" 
+				   >
+	<fx:Script>
+		<![CDATA[
+			
+			import org.apache.flex.html.staticControls.*;
+			
+			private function tmp():void
+			{
+				var myButton:Button;
+				
+				myButton = new Button();				
+			}
+			
+		]]>
+	</fx:Script>
+</basic:Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0fa98cfe/compiler.jx.tests/test-files/flexjs/files/wildcard_import_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/wildcard_import_result.js b/compiler.jx.tests/test-files/flexjs/files/wildcard_import_result.js
new file mode 100644
index 0000000..85f85db
--- /dev/null
+++ b/compiler.jx.tests/test-files/flexjs/files/wildcard_import_result.js
@@ -0,0 +1,82 @@
+goog.provide('wildcard_import');
+
+goog.require('org.apache.flex.core.Application');
+goog.require('org.apache.flex.html.staticControls.Button');
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.core.Application}
+ */
+wildcard_import = function() {
+	goog.base(this);
+	
+	/**
+	 * @private
+	 * @type {Array}
+	 */
+	this.mxmldd;
+	
+	/**
+	 * @private
+	 * @type {Array}
+	 */
+	this.mxmldp;
+};
+goog.inherits(wildcard_import, org.apache.flex.core.Application);
+
+
+wildcard_import.prototype.tmp = function() {
+	var self = this;
+	var /** @type {Button} */ self.myButton;
+	self.myButton = new org.apache.flex.html.staticControls.Button();
+};
+
+/**
+ * @override
+ * @this {wildcard_import}
+ * @return {Array} the Array of UI element descriptors.
+ */
+wildcard_import.prototype.get_MXMLDescriptor = function()
+{
+	if (this.mxmldd == undefined)
+	{
+		/** @type {Array} */
+		var arr = goog.base(this, 'get_MXMLDescriptor');
+		/** @type {Array} */
+		var data = [
+];
+	
+		if (arr)
+			this.mxmldd = arr.concat(data);
+		else
+			this.mxmldd = data;
+	}
+	return this.mxmldd;
+};
+
+/**
+ * @override
+ * @this {wildcard_import}
+ * @return {Array} the Array of UI element descriptors.
+ */
+wildcard_import.prototype.get_MXMLProperties = function()
+{
+	if (this.mxmldp == undefined)
+	{
+		/** @type {Array} */
+		var arr = goog.base(this, 'get_MXMLProperties');
+		/** @type {Array} */
+		var data = [
+0,
+0,
+0
+];
+	
+		if (arr)
+			this.mxmldp = arr.concat(data);
+		else
+			this.mxmldp = data;
+	}
+	return this.mxmldp;
+};
+

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0fa98cfe/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 0531278..cdff146 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -87,8 +87,11 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         currentInstances = new ArrayList<MXMLDescriptorSpecifier>();
         currentPropertySpecifiers = new ArrayList<MXMLDescriptorSpecifier>();
 
-        isMainFile = !isMXMLContentNode((IMXMLPropertySpecifierNode) node
-                .getPropertySpecifierNodes()[0]);
+        isMainFile = true;
+        IMXMLPropertySpecifierNode[] propertySpecifierNodes = node
+                .getPropertySpecifierNodes();
+        if (propertySpecifierNodes != null && propertySpecifierNodes.length > 0)
+            isMainFile = !isMXMLContentNode((IMXMLPropertySpecifierNode) propertySpecifierNodes[0]);
 
         eventCounter = 0;
         idCounter = 0;
@@ -110,9 +113,9 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         }
 
         String cname = node.getFileNode().getName();
-        
+
         emitHeader(node);
-        
+
         writeNewline();
         writeNewline("/**");
         writeNewline(" * @constructor");
@@ -123,7 +126,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         write(ASEmitterTokens.FUNCTION);
         write(ASEmitterTokens.PAREN_OPEN);
         writeToken(ASEmitterTokens.PAREN_CLOSE);
-        if (!isMainFile)
+        if (!isMainFile || propertySpecifierNodes == null)
             indentPush();
         writeNewline(ASEmitterTokens.BLOCK_OPEN, true);
         write(JSGoogEmitterTokens.GOOG_BASE);
@@ -188,7 +191,8 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
             writeNewline(ASEmitterTokens.BLOCK_OPEN, true);
 
             writeNewline("var self = this;");
-            writeNewline(event.value + ASEmitterTokens.SEMICOLON.getToken(), false);
+            writeNewline(event.value + ASEmitterTokens.SEMICOLON.getToken(),
+                    false);
 
             write(ASEmitterTokens.BLOCK_CLOSE);
             writeNewline(";");
@@ -333,7 +337,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
                 .getASEmitter();
 
         String indent = getIndent(getCurrentIndent());
-        
+
         StringBuilder sb = null;
         int len = node.getChildCount();
         if (len > 0)
@@ -547,7 +551,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
     private void emitHeader(IMXMLDocumentNode node)
     {
         String cname = node.getFileNode().getName();
-        
+
         emitHeaderLine(cname, true);
         writeNewline();
         emitHeaderLine(node.getBaseClassName());
@@ -570,7 +574,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
             }
         }
     }
-    
+
     private void emitHeaderLine(String qname)
     {
         emitHeaderLine(qname, false);
@@ -600,7 +604,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         if (cnode.getValue() != null)
             getMXMLWalker().walk((IASNode) cnode); // Literal
     }
-    
+
     private MXMLDescriptorSpecifier getCurrentDescriptor(String type)
     {
         MXMLDescriptorSpecifier currentDescriptor = null;


[2/3] git commit: [FalconJX] full AS project test capability

Posted by er...@apache.org.
[FalconJX] full AS project test capability

Added the ability to test full AS projects to TestBase.java. Since some functionalities of AS only become apparent when compiling projects consisting of 2 or more classes, this ability is needed as part of the full test suite.

Note: this commit adds 2 libraries to the compiler.jx.tests build path: '/compiler.jx/lib/commons-io.jar' and '/compiler.jx/lib/google/closure-compiler/compiler.jar', both of which are already part of the compiler.jx project.
Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/248da586
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/248da586
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/248da586

Branch: refs/heads/develop
Commit: 248da5867e49f6a5f59c4fd455fdf4a1152ba402
Parents: 0fa98cf
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Apr 10 12:02:40 2013 +0200
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Apr 10 12:02:40 2013 +0200

----------------------------------------------------------------------
 compiler.jx.tests/.classpath                       |    2 +
 .../flex/compiler/internal/test/TestBase.java      |  102 ++++++++++++++-
 2 files changed, 103 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/248da586/compiler.jx.tests/.classpath
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/.classpath b/compiler.jx.tests/.classpath
index fedc702..d268df0 100644
--- a/compiler.jx.tests/.classpath
+++ b/compiler.jx.tests/.classpath
@@ -5,5 +5,7 @@
 	<classpathentry combineaccessrules="false" kind="src" path="/compiler"/>
 	<classpathentry kind="lib" path="lib/junit-4.10.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/compiler.jx"/>
+	<classpathentry kind="lib" path="/compiler.jx/lib/google/closure-compiler/compiler.jar"/>
+	<classpathentry kind="lib" path="/compiler.jx/lib/commons-io.jar"/>
 	<classpathentry kind="output" path="classes"/>
 </classpath>

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/248da586/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 7317422..45721a0 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
@@ -23,6 +23,7 @@ import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertThat;
 
+import java.io.BufferedOutputStream;
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
@@ -38,11 +39,13 @@ import java.util.List;
 
 import org.apache.flex.compiler.codegen.as.IASEmitter;
 import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
+import org.apache.flex.compiler.config.Configurator;
 import org.apache.flex.compiler.driver.IBackend;
 import org.apache.flex.compiler.internal.codegen.as.ASFilterWriter;
 import org.apache.flex.compiler.internal.projects.FlexProject;
 import org.apache.flex.compiler.internal.projects.FlexProjectConfigurator;
 import org.apache.flex.compiler.internal.projects.ISourceFileHandler;
+import org.apache.flex.compiler.internal.targets.JSTarget;
 import org.apache.flex.compiler.internal.tree.as.FunctionNode;
 import org.apache.flex.compiler.internal.workspaces.Workspace;
 import org.apache.flex.compiler.mxml.IMXMLNamespaceMapping;
@@ -60,6 +63,9 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
 
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+
 @Ignore
 public class TestBase implements ITestBase
 {
@@ -201,6 +207,95 @@ public class TestBase implements ITestBase
         return fileNode;
     }
 
+    protected List<String> compileProject(String inputFileName, String inputDirName)
+    {
+        List<String> compiledFileNames = new ArrayList<String>();
+
+        String mainFileName = inputDirName + File.separator + inputFileName
+                + inputFileExtension;
+
+        addDependencies();
+
+        ICompilationUnit mainCU = Iterables
+                .getOnlyElement(workspace.getCompilationUnits(
+                        FilenameNormalization.normalize(mainFileName), project));
+
+        Configurator projectConfigurator = backend.createConfigurator();
+
+        JSTarget target = (JSTarget) backend.createTarget(project,
+                projectConfigurator.getTargetSettings(null), null);
+
+        target.build(mainCU, new ArrayList<ICompilerProblem>());
+
+        List<ICompilationUnit> reachableCompilationUnits = project
+                .getReachableCompilationUnitsInSWFOrder(ImmutableSet.of(mainCU));
+        for (final ICompilationUnit cu : reachableCompilationUnits)
+        {
+            try
+            {
+                ICompilationUnit.UnitType cuType = cu.getCompilationUnitType();
+
+                if (cuType == ICompilationUnit.UnitType.AS_UNIT
+                        || cuType == ICompilationUnit.UnitType.MXML_UNIT)
+                {
+                    File outputRootDir = new File(
+                            FilenameNormalization.normalize(tempDir
+                                    + File.separator + inputDirName));
+
+                    String qname = cu.getQualifiedNames().get(0);
+
+                    compiledFileNames.add(qname.replace(".", "/"));
+
+                    final File outputClassFile = getOutputClassFile(qname
+                            + "_output", outputRootDir);
+
+                    ASFilterWriter writer = backend.createWriterBuffer(project);
+                    IASEmitter emitter = backend.createEmitter(writer);
+                    IASBlockWalker walker = backend.createWalker(project,
+                            (List<ICompilerProblem>) errors, emitter);
+
+                    walker.visitCompilationUnit(cu);
+
+                    //System.out.println(writer.toString());
+
+                    BufferedOutputStream out = new BufferedOutputStream(
+                            new FileOutputStream(outputClassFile));
+
+                    out.write(writer.toString().getBytes());
+                    out.flush();
+                    out.close();
+                }
+            }
+            catch (Exception e)
+            {
+                //System.out.println(e.getMessage());
+            }
+        }
+
+        return compiledFileNames;
+    }
+
+    private File getOutputClassFile(String qname, File outputFolder)
+    {
+        String[] cname = qname.split("\\.");
+        String sdirPath = outputFolder + File.separator;
+        if (cname.length > 0)
+        {
+            for (int i = 0, n = cname.length - 1; i < n; i++)
+            {
+                sdirPath += cname[i] + File.separator;
+            }
+
+            File sdir = new File(sdirPath);
+            if (!sdir.exists())
+                sdir.mkdirs();
+
+            qname = cname[cname.length - 1];
+        }
+
+        return new File(sdirPath + qname + "." + backend.getOutputExtension());
+    }
+
     protected IMXMLFileNode compileMXML(String input)
     {
         return compileMXML(input, false, "");
@@ -320,11 +415,16 @@ public class TestBase implements ITestBase
                 + File.separator + sourceDir + File.separator + fileName
                 + (isJS ? ".js" : inputFileExtension));
 
+        return readCodeFile(testFile);
+    }
+
+    protected String readCodeFile(File file)
+    {
         String code = "";
         try
         {
             BufferedReader in = new BufferedReader(new InputStreamReader(
-                    new FileInputStream(testFile), "UTF8"));
+                    new FileInputStream(file), "UTF8"));
 
             String line = in.readLine();
 


[3/3] git commit: [FalconJX] imports project test

Posted by er...@apache.org.
[FalconJX] imports project test

Added a test of a full project aimed at testing the correct creation of 'goog.required' statements. Right now the 'result' files DO NOT represent the eventual expected outcome; this test is more a proof of concept for the 'full project test' capability of TestBase.java.

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/c050380d
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/c050380d
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/c050380d

Branch: refs/heads/develop
Commit: c050380d90c8bd1277e98ef0aaf4b918fe1310a4
Parents: 248da58
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Apr 10 12:05:10 2013 +0200
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Apr 10 12:05:10 2013 +0200

----------------------------------------------------------------------
 .../internal/codegen/js/goog/TestGoogProject.java  |   94 +++++++++++++++
 .../test-files/goog/projects/imports/Case.as       |   12 ++
 .../goog/projects/imports/Case_result.js           |   11 ++
 .../test-files/goog/projects/imports/comps/A.as    |   10 ++
 .../goog/projects/imports/comps/A_result.js        |    9 ++
 .../test-files/goog/projects/imports/comps/B.as    |    9 ++
 .../goog/projects/imports/comps/B_result.js        |    7 +
 7 files changed, 152 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c050380d/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
new file mode 100644
index 0000000..1100824
--- /dev/null
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogProject.java
@@ -0,0 +1,94 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+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.junit.Test;
+
+/**
+ * This class tests the production of valid 'goog' JS code from an external
+ * project.
+ * 
+ * @author Erik de Bruin
+ */
+public class TestGoogProject extends ASTestBase
+{
+
+    private static String projectDirPath = "goog/projects";
+
+    @Test
+    public void test_imports()
+    {
+        String testDirPath = projectDirPath + "/imports";
+
+        String fileName = "Case";
+
+        List<String> compiledFileNames = compileProject(fileName, "test-files"
+                + File.separator + testDirPath);
+
+        assertProjectOut(compiledFileNames, testDirPath);
+    }
+
+    @Override
+    protected void addSourcePaths(List<File> sourcePaths)
+    {
+        sourcePaths.add(new File(FilenameNormalization.normalize("test-files"
+                + File.separator + projectDirPath + "/imports")));
+
+        super.addSourcePaths(sourcePaths);
+    }
+
+    @Override
+    protected IBackend createBackend()
+    {
+        return new GoogBackend();
+    }
+
+    protected void assertProjectOut(List<String> compiledFileNames,
+            String testDirPath)
+    {
+        for (String compiledFileName : compiledFileNames)
+        {
+            String compiledFilePath = tempDir.getAbsolutePath()
+                    + File.separator + testDirPath + File.separator
+                    + compiledFileName + "_output" + "."
+                    + backend.getOutputExtension();
+            String compiledResult = readCodeFile(new File(compiledFilePath));
+
+            String expectedFilePath = new File("test-files").getAbsolutePath()
+                    + File.separator + testDirPath + File.separator
+                    + compiledFileName + "_result" + "."
+                    + backend.getOutputExtension();
+            String expectedResult = readCodeFile(new File(expectedFilePath));
+
+            assertThat(compiledResult, is(expectedResult));
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c050380d/compiler.jx.tests/test-files/goog/projects/imports/Case.as
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/goog/projects/imports/Case.as b/compiler.jx.tests/test-files/goog/projects/imports/Case.as
new file mode 100644
index 0000000..4aed38d
--- /dev/null
+++ b/compiler.jx.tests/test-files/goog/projects/imports/Case.as
@@ -0,0 +1,12 @@
+package
+{
+	import comps.A;
+
+    public class Case
+    {
+        public function Case()
+        {
+            var bar:A = new A();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c050380d/compiler.jx.tests/test-files/goog/projects/imports/Case_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/goog/projects/imports/Case_result.js b/compiler.jx.tests/test-files/goog/projects/imports/Case_result.js
new file mode 100644
index 0000000..928234a
--- /dev/null
+++ b/compiler.jx.tests/test-files/goog/projects/imports/Case_result.js
@@ -0,0 +1,11 @@
+goog.provide('Case');
+
+goog.require('comps.A');
+
+/**
+ * @constructor
+ */
+Case = function() {
+	var self = this;
+	var /** @type {comps.A} */ bar = new comps.A();
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c050380d/compiler.jx.tests/test-files/goog/projects/imports/comps/A.as
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/goog/projects/imports/comps/A.as b/compiler.jx.tests/test-files/goog/projects/imports/comps/A.as
new file mode 100644
index 0000000..fda31a6
--- /dev/null
+++ b/compiler.jx.tests/test-files/goog/projects/imports/comps/A.as
@@ -0,0 +1,10 @@
+package comps
+{
+    public class A
+    {
+        public function A()
+        {
+            var foo:B = new B();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c050380d/compiler.jx.tests/test-files/goog/projects/imports/comps/A_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/goog/projects/imports/comps/A_result.js b/compiler.jx.tests/test-files/goog/projects/imports/comps/A_result.js
new file mode 100644
index 0000000..5280574
--- /dev/null
+++ b/compiler.jx.tests/test-files/goog/projects/imports/comps/A_result.js
@@ -0,0 +1,9 @@
+goog.provide('comps.A');
+
+/**
+ * @constructor
+ */
+comps.A = function() {
+	var self = this;
+	var /** @type {comps.B} */ foo = new B();
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c050380d/compiler.jx.tests/test-files/goog/projects/imports/comps/B.as
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/goog/projects/imports/comps/B.as b/compiler.jx.tests/test-files/goog/projects/imports/comps/B.as
new file mode 100644
index 0000000..38addd5
--- /dev/null
+++ b/compiler.jx.tests/test-files/goog/projects/imports/comps/B.as
@@ -0,0 +1,9 @@
+package comps
+{
+    public class B
+    {
+        public function B()
+        {
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c050380d/compiler.jx.tests/test-files/goog/projects/imports/comps/B_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/goog/projects/imports/comps/B_result.js b/compiler.jx.tests/test-files/goog/projects/imports/comps/B_result.js
new file mode 100644
index 0000000..d487b8a
--- /dev/null
+++ b/compiler.jx.tests/test-files/goog/projects/imports/comps/B_result.js
@@ -0,0 +1,7 @@
+goog.provide('comps.B');
+
+/**
+ * @constructor
+ */
+comps.B = function() {
+};
\ No newline at end of file