Hi Paul, I don't believe this is correct for ActionScript3. Strict equality is the "===" operator which compares object instances. "==" should test for equality.
If you change the test to this... [Test] public function testXmlEquality():void { var xml1:XML = <a> <b></b> <c></c> </a>; var xml2:XML = <a> <b></b> <c></c> </a>; xml1.normalize(); xml2.normalize(); Assert.assertTrue(xml1 == xml2); } it passes. XML/e4x is supposed to support this out of the box, and it does -- to a degree. Although, semantically and syntactically, xml1 and xml2 from the 1st test are equivalent, e4x is not thinking so, and I think that is broken. Searching for a workaround has popped up very little, which is why I was hoping someone on the list might have a good answer for why this is, and how I can test XML equivalence without caring about element ordering. Regards, Davis On Wed, Jan 6, 2010 at 7:03 PM, Paul Andrews <p...@ipauland.com> wrote: > > > Davis Ford wrote: > > > > > > Why does this test fail? Is there any way to test for equality that > > ignores the ordering of elements -- which shouldn't technically matter? > > > > [Test] > > public function testXmlEquality():void { > > var xml1:XML = > > <a> > > <b></b> > > <c></c> > > </a>; > > var xml2:XML = > > <a> > > <c></c> > > <b></b> > > </a>; > > Assert.assertTrue(xml1 == xml2); > > } > xml1 and xml2 are references to objects. Because they are different > objects they are not equal - the references are different. > > > > > > > > > > > > > -- Zeno Consulting, Inc. home: http://www.zenoconsulting.biz blog: http://zenoconsulting.wikidot.com p: 248.894.4922 f: 313.884.2977