assert

Richmond richmondmathewson at gmail.com
Sun Feb 23 10:55:51 EST 2014


On 23/02/14 15:47, Björnke von Gierke wrote:
> on mouseUp
>    assert 1 + "blah"
> end mouseUp

Well that certainly threw up an error message.

But this:

on mouseUp
     put 1 + "blah" into FUDGE
end mouseUp

also threw up an error message.
--------------------------------------------------
> on assertError dont, remember, amountOfParameters
>    put dont & remember & amountOfParameters
> end assert

When I tried to put that one in my button I got this:

button "Button": compilation error at line 8 (Handler: end doesn't match 
handler name) near "assert", char 1

in the scriptEditor when I tried to apply it.

--------------------------------------------------------

When I tried this:

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

NOTHING appeared in the Message Box.

Richmond.

>
> 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
>





More information about the use-livecode mailing list