Changed the tests for the new interface member emission. 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/e3eff8e9 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/e3eff8e9 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/e3eff8e9 Branch: refs/heads/maven Commit: e3eff8e9191802a7c7b83cefaa06f79ad13dc286 Parents: 15035e6 Author: Erik de Bruin <e...@ixsoftware.nl> Authored: Fri Dec 6 10:11:41 2013 +0100 Committer: Erik de Bruin <e...@ixsoftware.nl> Committed: Fri Dec 6 10:11:41 2013 +0100 ---------------------------------------------------------------------- .../codegen/js/flexjs/TestFlexJSInterface.java | 37 ++++++++++++++++++++ .../flexjs/projects/interfaces/interfaces/IE.as | 6 +++- .../projects/interfaces/interfaces/IE_result.js | 9 +++++ 3 files changed, 51 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e3eff8e9/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java index e2de1df..d95eef1 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java @@ -22,6 +22,8 @@ package org.apache.flex.compiler.internal.codegen.js.flexjs; import org.apache.flex.compiler.driver.IBackend; import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogInterface; import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; +import org.apache.flex.compiler.tree.as.IInterfaceNode; +import org.junit.Test; /** * This class tests the production of valid 'goog' JS code for Interface @@ -33,6 +35,41 @@ import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; public class TestFlexJSInterface extends TestGoogInterface { + @Override + @Test + public void testAccessors() + { + IInterfaceNode node = getInterfaceNode("public interface IA {" + + "function get foo1():Object;" + + "function set foo1(value:Object):void;}"); + asBlockWalker.visitInterface(node); + assertOut("/**\n * @interface\n */\nIA = function() {\n};\n\n\nIA.prototype.get_foo1 = function() {};\n\n\nIA.prototype.set_foo1 = function() {};"); + } + + @Override + @Test + public void testMethods() + { + IInterfaceNode node = getInterfaceNode("public interface IA {" + + "function baz1():Object;" + + "function baz2(value:Object):void;}"); + asBlockWalker.visitInterface(node); + assertOut("/**\n * @interface\n */\nIA = function() {\n};\n\n\nIA.prototype.baz1 = function() {};\n\n\nIA.prototype.baz2 = function(value) {};"); + } + + @Override + @Test + public void testAccessorsMethods() + { + IInterfaceNode node = getInterfaceNode("public interface IA {" + + "function get foo1():Object;" + + "function set foo1(value:Object):void;" + + "function baz1():Object;" + + "function baz2(value:Object):void;}"); + asBlockWalker.visitInterface(node); + assertOut("/**\n * @interface\n */\nIA = function() {\n};\n\n\nIA.prototype.get_foo1 = function() {};\n\n\nIA.prototype.set_foo1 = function() {};\n\n\nIA.prototype.baz1 = function() {};\n\n\nIA.prototype.baz2 = function(value) {};"); + } + protected IBackend createBackend() { return new FlexJSBackend(); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e3eff8e9/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE.as ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE.as b/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE.as index b40e49e..4fe6ad4 100644 --- a/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE.as +++ b/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE.as @@ -1,4 +1,8 @@ package interfaces { - public interface IE {} + public interface IE { + function myMethod():void; + function get myProp():String; + function set myProp(value:String):void; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e3eff8e9/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js b/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js index 1455342..d3f50b1 100644 --- a/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js +++ b/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js @@ -17,6 +17,15 @@ interfaces.IE = function() { }; +interfaces.IE.prototype.myMethod = function() {}; + + +interfaces.IE.prototype.get_myProp = function() {}; + + +interfaces.IE.prototype.set_myProp = function() {}; + + /** * Metadata *