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;
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
eh..that wasn't supposed to be in there -- copy/paste hackery...
xml1.normalize();
xml2.normalize();
Davis Ford wrote:
Hi Paul,
I don't believe this is correct for ActionScript3. Strict equality is
the === operator which compares object instances. == should test
for equality.
I tried (in Flash)..
var objA:Object = {a:1};
var objB:Object = {a:1};
trace(objA==objB); // false
var
I found a solution:
import mx.utils.ObjectUtil;
Assert.assertTrue(ObjectUtil.compare(xml1, xml2) == 0);
That does the trick.
Regards,
Davis
On Wed, Jan 6, 2010 at 8:20 PM, Paul Andrews p...@ipauland.com wrote:
Davis Ford wrote:
Hi Paul,
I don't believe this is correct for
...@yahoogroups.com] On Behalf
Of Davis Ford
Sent: Wednesday, January 06, 2010 5:22 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Testing for XML equality
I found a solution:
import mx.utils.ObjectUtil;
Assert.assertTrue(ObjectUtil.compare(xml1, xml2) == 0);
That does the trick.
Regards
Of *Davis Ford
*Sent:* Wednesday, January 06, 2010 5:22 PM
*To:* flexcoders@yahoogroups.com
*Subject:* Re: [flexcoders] Testing for XML equality
I found a solution:
import mx.utils.ObjectUtil;
Assert.assertTrue(ObjectUtil.compare(xml1, xml2) == 0);
That does the trick.
Regards
7 matches
Mail list logo