Fixed tests to reflect the new location ('org.apache.flex.utils.Language') of the global language support functions - 'as', 'int', 'is', 'trace' and 'uint'.
Signed-off-by: Erik de Bruin <e...@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/c61fbb12 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/c61fbb12 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/c61fbb12 Branch: refs/heads/develop Commit: c61fbb1271cb8478ddb2d0916b0038c161233272 Parents: cf2db50 Author: Erik de Bruin <e...@ixsoftware.nl> Authored: Fri Nov 1 09:47:08 2013 +0100 Committer: Erik de Bruin <e...@ixsoftware.nl> Committed: Fri Nov 1 12:32:58 2013 +0100 ---------------------------------------------------------------------- .../js/flexjs/TestFlexJSExpressions.java | 7 ++--- .../js/flexjs/TestFlexJSGlobalClasses.java | 2 +- .../js/flexjs/TestFlexJSGlobalFunctions.java | 29 ++++++++++++++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c61fbb12/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java index 96ba5fa..8c15248 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java @@ -22,7 +22,6 @@ package org.apache.flex.compiler.internal.codegen.js.flexjs; import org.apache.flex.compiler.definitions.IDefinition; import org.apache.flex.compiler.driver.IBackend; import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogExpressions; -import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter; import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; import org.apache.flex.compiler.internal.tree.as.ClassNode; import org.apache.flex.compiler.internal.tree.as.NodeBase; @@ -654,7 +653,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions { IBinaryOperatorNode node = getBinaryNode("a as b"); asBlockWalker.visitBinaryOperator(node); - assertOut("(is(a, b) ? a : null)"); + assertOut("org.apache.flex.utils.Language.as(a, b)"); } @Test @@ -664,7 +663,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions "public class B {public function b(o:Object):int { var a:B; a = o as B; }}", IFunctionNode.class, WRAP_LEVEL_PACKAGE, true); asBlockWalker.visitFunction(node); - assertOut("/**\n * @expose\n * @param {Object} o\n * @return {number}\n */\nfoo.bar.B.prototype.b = function(o) {\n\tvar /** @type {B} */ a;\n\ta = (is(o, foo.bar.B) ? o : null);\n}"); + assertOut("/**\n * @expose\n * @param {Object} o\n * @return {number}\n */\nfoo.bar.B.prototype.b = function(o) {\n\tvar /** @type {B} */ a;\n\ta = org.apache.flex.utils.Language.as(o, foo.bar.B);\n}"); } @Override @@ -673,7 +672,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions { IBinaryOperatorNode node = getBinaryNode("a is b"); asBlockWalker.visitBinaryOperator(node); - assertOut("is(a, b)"); + assertOut("org.apache.flex.utils.Language.is(a, b)"); } protected IBackend createBackend() http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c61fbb12/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java index 4d3ae87..721e9ff 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java @@ -44,7 +44,7 @@ public class TestFlexJSGlobalClasses extends TestGoogGlobalClasses { IFunctionNode node = getMethod("function a():void {\ttrace(arguments);}"); asBlockWalker.visitFunction(node); - assertOut("FalconTest_A.prototype.a = function() {\n\ttrace(arguments);\n}"); + assertOut("FalconTest_A.prototype.a = function() {\n\torg.apache.flex.utils.Language.trace(arguments);\n}"); } @Override http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c61fbb12/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java index 7cdeebc..cbb9ee4 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java @@ -23,6 +23,7 @@ import org.apache.flex.compiler.driver.IBackend; import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogGlobalFunctions; import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; import org.apache.flex.compiler.tree.as.IBinaryOperatorNode; +import org.apache.flex.compiler.tree.as.IFunctionCallNode; import org.apache.flex.compiler.tree.as.IVariableNode; import org.junit.Ignore; import org.junit.Test; @@ -48,6 +49,34 @@ public class TestFlexJSGlobalFunctions extends TestGoogGlobalFunctions @Override @Test + public void testInt() + { + IVariableNode node = getVariable("var a:int = int(1.8);"); + asBlockWalker.visitVariable(node); + assertOut("var /** @type {number} */ a = org.apache.flex.utils.Language.int(1.8)"); + } + + @Override + @Test + public void testTrace() + { + IFunctionCallNode node = (IFunctionCallNode) getNode( + "trace('Hello World');", IFunctionCallNode.class); + asBlockWalker.visitFunctionCall(node); + assertOut("org.apache.flex.utils.Language.trace('Hello World')"); + } + + @Override + @Test + public void testUint() + { + IVariableNode node = getVariable("var a:uint = uint(-100);"); + asBlockWalker.visitVariable(node); + assertOut("var /** @type {number} */ a = org.apache.flex.utils.Language.uint(-100)"); + } + + @Override + @Test public void testVector() { IVariableNode node = getVariable("var a:Vector.<String> = Vector.<String>(['Hello', 'World']);");