|
From: beRt b. <beR...@al...> - 2005-01-11 12:37:24
|
Hi,
meanwhile I wrote my own implementation without the interface ... It
uses the equals() of the object if there is any, and otherwise uses ==
instead of ===, because you don't want strict equality here on Numbers,
Strings, ...
It also provides some message if you don't specify one.
Here it is:
public static function assertEquals(msg:Object, assertion1:Object,
assertion2:Object):Void {
if(arguments.length == 2) {
assertion2 = assertion1;
assertion1 = msg;
msg = assertion1 + " vs. " + assertion2;
}
var result:Boolean;
if ("function"== typeof(assertion1.equals)){
result = assertion1.equals(assertion2);
}else{
result = (assertion1 == assertion2);
}
addTestResult(String(msg), "assertEquals", result);
}
Luke Bayes wrote:
> OK -
>
> I don't really feel too strongly either way. I just released the
> latest build of AsUnit (2.5) over the weekend with the requested
> change to call the "equals" method.
>
> If you don't want to enforce Comparable, or if you want to make the
> call to equals() optional, we might have to make some minor changes...
>
> There might be some problems in Flex and ultimately MTASC
> compatibility if we start calling optional methods... (not sure
> though)
>
> I definitely don't think it's too much to ask for someone to implement
> an Interface if they want to use a more advanced portion of the
> framework.
>
> Let me know what you folks want to do for the next release.
>
>
> Thanks,
>
>
> Luke Bayes
> www.asunit.com
>
>
> -------------------------------------------------------
> The SF.Net email is sponsored by: Beat the post-holiday blues
> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> _______________________________________________
> Asunit-users mailing list
> Asu...@li...
> https://lists.sourceforge.net/lists/listinfo/asunit-users
>
|