Skip to main content
Participating Frequently
November 11, 2008
Question

assert() API?

  • November 11, 2008
  • 2 replies
  • 837 views
Is there an API to force an assert?

Specifically:

assert("Something went wrong");

I am doing some async tests, and in one case I am testing if an IO_ErrorEvent occurs. If it does, I want to do an assert:

private function onConnectError(e:IOErrorEvent):void
{
assert("Connection Failed : " + e.text, false);
}

Right now I have to do:

private function onConnectError(e:IOErrorEvent):void
{
assertTrue("Connection Failed : " + e.text, false);
}

Looking through the APIs i did not see an assert() api.

I would be happy to add one myself.

mike chambers
This topic has been closed for replies.

2 replies

Participating Frequently
November 11, 2008
Thanks. That is exactly what I was looking for.

mike
Participating Frequently
November 11, 2008
For FlexUnit if you what something to always fail use:<br /><br />fail("Fail message");<br /><br />-- Daniel R. <danielr@neophi.com> [http://danielr.neophi.com/]<br /><br /><br /><br />On Tue, Nov 11, 2008 at 1:27 PM, Mike Chambers <member@adobeforums.com> wrote:<br />> A new discussion was started by Mike Chambers in<br />><br />> FlexUnit Development --<br />> assert() API?<br />><br />> Is there an API to force an assert?<br />><br />> Specifically:<br />><br />> assert("Something went wrong");<br />><br />> I am doing some async tests, and in one case I am testing if an<br />> IO_ErrorEvent occurs. If it does, I want to do an assert:<br />><br />> private function onConnectError(e:IOErrorEvent):void<br />> {<br />> assert("Connection Failed : " + e.text, false);<br />> }<br />><br />> Right now I have to do:<br />><br />> private function onConnectError(e:IOErrorEvent):void<br />> {<br />> assertTrue("Connection Failed : " + e.text, false);<br />> }<br />><br />> Looking through the APIs i did not see an assert() api.<br />><br />> I would be happy to add one myself.<br />><br />> mike chambers<br />><br />> ________________________________<br />> View/reply at assert() API?<br />> Replies by email are OK.<br />> Use the unsubscribe form to cancel your email subscription.<br />><br />>