You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jo...@apache.org on 2016/01/12 22:11:58 UTC

[2/4] git commit: [flex-falcon] [refs/heads/develop] - compiler.jx.tests: added tests for internal file-level functions and variables after package

compiler.jx.tests: added tests for internal file-level functions and variables after package


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

Branch: refs/heads/develop
Commit: 2d9c9441187cd48e1d81df7668da81c3bcf5e56c
Parents: 0df8a51
Author: Josh Tynjala <jo...@apache.org>
Authored: Tue Jan 12 12:12:20 2016 -0800
Committer: Josh Tynjala <jo...@apache.org>
Committed: Tue Jan 12 12:12:20 2016 -0800

----------------------------------------------------------------------
 .../codegen/js/flexjs/TestFlexJSPackage.java    | 89 ++++++++++++++++++++
 1 file changed, 89 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2d9c9441/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
index dfb4b75..6469c6e 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
@@ -141,6 +141,95 @@ public class TestFlexJSPackage extends TestGoogPackage
         		  "foo.bar.baz.A.InternalClass.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'InternalClass', qName: 'foo.bar.baz.A.InternalClass'}] };\n");
     }
 
+	@Test
+	public void testPackageQualified_ClassAndInternalFunction()
+	{
+		IFileNode node = compileAS("package foo.bar.baz {\n" +
+				"public class A {\n" +
+				"public function A(){\n" +
+				"internalFunction();\n" +
+				"}}}\n" +
+				"function internalFunction(){}");
+		asBlockWalker.visitFile(node);
+		assertOutWithMetadata("/**\n" +
+				" * foo.bar.baz.A\n" +
+				" *\n" +
+				" * @fileoverview\n" +
+				" *\n" +
+				" * @suppress {checkTypes|accessControls}\n" +
+				" */\n" +
+				"\n" +
+				"goog.provide('foo.bar.baz.A');\n" +
+				"\n" +
+				"\n" +
+				"\n" +
+				"/**\n" +
+				" * @constructor\n" +
+				" */\n" +
+				"foo.bar.baz.A = function() {\n" +
+				"  foo.bar.baz.A.internalFunction();\n" +
+				"};\n" +
+				"\n" +
+				"\n/" +
+				"**\n" +
+				" * Metadata\n" +
+				" *\n" +
+				" * @type {Object.<string, Array.<Object>>}\n" +
+				" */\n" +
+				"foo.bar.baz.A.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'A', qName: 'foo.bar.baz.A'}] };\n" +
+				"\n" +
+				"\n" +
+				"\n" +
+				"foo.bar.baz.A.internalFunction = function() {\n" +
+				"}");
+	}
+
+	@Test
+	public void testPackageQualified_ClassAndInternalVariable()
+	{
+		IFileNode node = compileAS("package foo.bar.baz {\n" +
+				"public class A {\n" +
+				"public function A(){\n" +
+				"internalVar = 3;\n" +
+				"}}}\n" +
+				"var internalVar:Number = 2;");
+		asBlockWalker.visitFile(node);
+		assertOutWithMetadata("/**\n" +
+				" * foo.bar.baz.A\n" +
+				" *\n" +
+				" * @fileoverview\n" +
+				" *\n" +
+				" * @suppress {checkTypes|accessControls}\n" +
+				" */\n" +
+				"\n" +
+				"goog.provide('foo.bar.baz.A');\n" +
+				"\n" +
+				"\n" +
+				"\n" +
+				"/**\n" +
+				" * @constructor\n" +
+				" */\n" +
+				"foo.bar.baz.A = function() {\n" +
+				"  foo.bar.baz.A.internalVar = 3;\n" +
+				"};\n" +
+				"\n" +
+				"\n/" +
+				"**\n" +
+				" * Metadata\n" +
+				" *\n" +
+				" * @type {Object.<string, Array.<Object>>}\n" +
+				" */\n" +
+				"foo.bar.baz.A.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'A', qName: 'foo.bar.baz.A'}] };\n" +
+				"\n" +
+				"\n" +
+				"\n" +
+				"/**\n" +
+				" * @export\n" +
+				" * @type {number}\n" +
+				" */\n" +
+				"foo.bar.baz.A.internalVar = 2");
+	}
+
     @Test
     public void testPackageQualified_ClassAndInternalClassMethods()
     {