Assertions

From Cuis CookBook
Jump to navigation Jump to search
  • This is very similar to what you know from other programming languages: assert: checks if something is true, if it is not it blocks the computations there and opens a debugger.  Try these two examples:
1 assert: (1 = 1).
'a' assert: (1 = 2).       " this opens a debugger "
  • Open now your Browser and go to check that assert is defined as an Object method.
  • You will often find assert sent to self, don't break the tradition if you don't have a very good reason.
fooMethod
   ...
   self assert: ( A TEST )
   ...