You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2018/10/03 07:58:05 UTC
[royale-compiler] branch develop updated: Added tests for XMLList
index
This is an automated email from the ASF dual-hosted git repository.
harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
The following commit(s) were added to refs/heads/develop by this push:
new 8a51c22 Added tests for XMLList index
8a51c22 is described below
commit 8a51c22f0ef608dd3964ff6063cf31f6bdaf0d75
Author: Harbs <ha...@in-tools.com>
AuthorDate: Wed Oct 3 10:57:53 2018 +0300
Added tests for XMLList index
---
.../codegen/js/royale/TestRoyaleGlobalClasses.java | 28 ++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleGlobalClasses.java b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleGlobalClasses.java
index b2c8a17..84312d9 100644
--- a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleGlobalClasses.java
+++ b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleGlobalClasses.java
@@ -586,6 +586,34 @@ public class TestRoyaleGlobalClasses extends TestGoogGlobalClasses
}
@Test
+ public void testXMLListAccess()
+ {
+ IVariableNode node = getVariable("var a:XML = new XML(\"<top attr1='cat'><child attr2='dog'><grandchild attr3='fish'>text</grandchild></child></top>\");var child:XML = a.child[0]");
+ IASNode parentNode = node.getParent();
+ node = (IVariableNode) parentNode.getChild(1);
+ asBlockWalker.visitVariable(node);
+ assertOut("var /** @type {XML} */ child = a.child('child')[0]");
+ }
+
+ @Test
+ public void testXMLListAccessComplex()
+ {
+ IVariableNode node = getVariable("var a:XML = new XML(\"<top attr1='cat'><child attr2='dog'><grandchild attr3='fish'>text</grandchild></child></top>\");var child:XML = a.child[a.child.length()-1]");
+ IASNode parentNode = node.getParent();
+ node = (IVariableNode) parentNode.getChild(1);
+ asBlockWalker.visitVariable(node);
+ assertOut("var /** @type {XML} */ child = a.child('child')[a.child('child').length() - 1]");
+ }
+ @Ignore
+ @Test
+ public void testXMLListAssignment()
+ {
+ IBinaryOperatorNode node = (IBinaryOperatorNode)getNode("var a:XMLList = new XMLList();a[a.length()] = <foo/>;a[a.length()] = <baz/>;", IBinaryOperatorNode.class);
+ asBlockWalker.visitBinaryOperator(node);
+ assertOut("a[a.length()] = new XML( '<foo/>')");
+ }
+
+ @Test
public void testXMLNameFunction()
{
IVariableNode node = getVariable("var a:XML = new XML(\"<top attr1='cat'><child attr2='dog'><grandchild attr3='fish'>text</grandchild></child></top>\");var b:String = a.name();");