You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2020/04/24 06:55:53 UTC

[royale-asjs] 03/06: Add XMLList top level 'coercion' test.

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

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

commit 843ba88365692e575a096d6f9ac06d01aa171848
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');
+
+        }
     }
 }