assert

Björnke von Gierke bvg at mac.com
Sun Feb 23 08:47:38 EST 2014


on mouseUp
  assert 1 + "blah"
end mouseUp

on assertError dont, remember, amountOfParameters
  put dont & remember & amountOfParameters
end assert

see release notes of 6.6 dp here: http://downloads.livecode.com/livecode/

On 23.02.2014, at 14:31, Richmond <richmondmathewson at gmail.com> wrote:

> Right; so here I am on a Sunday afternoon feeling
> suitably postprandial . . . and looking at the notes for 6.6 dp1
> and playing around with ASSERT
> 
> Set up a stack with a button with this script:
> 
> on mouseUp
>   assert 1 is 2
> end mouseUp
> 
> as per notes.
> 
> SO? Where is any sort of result????
> 
> tried this script:
> 
> on mouseUp
>   put assert (1 is 2) into fld "fOUT"
> end mouseUp
> 
> that one "threw a bluey"
> 
> as did:
> 
> on mouseUp
>   put assert (1 is 2)
> end mouseUp
> 
> So, I made another button with this script:
> 
> on mouseUp
>   if 1 is 2 then
>      put "Yup" into fld "fOUT"
>   else
>      put "Nope" into fld "fOUT"
>      end if
> end mouseUp
> 
> which worked perfectly.
> 
> ---------------------------------------------
> 
> SO; assert is meant to be a way to check for runtime errors
> 
> [which in my example above it certainly does NOT look like]
> 
> WHERE is one expected to see "fails" or "succeeds"
> 
> or, how does one know if assert has either failed or succeeded?
> 
> --------------------------------------------
> 
> Why not just run one's original script and see it the da*n things works?
> 
> -------------------------------------------
> 
> "if the condition fails, then an assertError message is sent to the object containing the
> command"
> 
> Where does the programmer see the assertError message?
> 
> ------------------------------------------
> 
> Richmond.
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


-- 

Use an alternative Dictionary viewer:
http://bjoernke.com/bvgdocu/

Chat with other RunRev developers:
http://bjoernke.com/chatrev/






More information about the use-livecode mailing list