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 2020/05/06 11:55:45 UTC

[royale-asjs] 02/07: Add XMLList top level 'coercion' test.

This is an automated email from the ASF dual-hosted git repository.

harbs pushed a commit to branch release/0.9.7
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit d5a77d36e5ad53162ff7aa3fd3cfba90503c823e
Author: greg-dove <gr...@gmail.com>
AuthorDate: Fri Apr 24 18:18:19 2020 +1200

    Add XMLList top level 'coercion' test.
---
 .../flexUnitTests/xml/XMLListTesterGeneralTest.as  | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLListTesterGeneralTest.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLListTesterGeneralTest.as
index c9b9e6e..139dafd 100644
--- a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLListTesterGeneralTest.as
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLListTesterGeneralTest.as
@@ -216,5 +216,32 @@ package flexUnitTests.xml
             }
             assertTrue(hadError, 'expected an error');
         }
+
+
+
+        [Test]
+        public function testCoercion():void{
+            var source:XML = <data>
+                <row>
+                    <Item someattribute="item1Att">item1</Item>
+                </row>
+                <row>
+                    <Item someattribute="item2Att">item2</Item>
+                </row>
+            </data>;
+
+            var list:XMLList = XMLList(source);
+            assertEquals(list.length(), 1, 'unexpected XMLList length');
+            assertEquals(source.row.length(), 2, 'unexpected XMLList length');
+
+            assertEquals(list.row.length(), 2, 'unexpected XMLList length');
+            var alt:XMLList = XMLList(list)
+            assertEquals(alt.length(), 1, 'unexpected XMLList length');
+            assertEquals(alt.row.length(), 2, 'unexpected XMLList length');
+            assertEquals(alt, list, 'unexpected XMLList equality');
+            assertStrictlyEquals(alt, list, 'unexpected XMLList strict equality');
+            assertStrictlyEquals(alt[0], source, 'unexpected XMLList content strict equality');
+
+        }
     }
 }