Wiki
Version 3 (modified by todd.a, 13 years ago)

--

Expect

This is a statement that provides an assertion capability for checking for thrown exceptions.

Its usually used in unit test code

Grammar

expect EXCEPTIONTYPE
    BLOCK

Examples

expect FormatException
    i = Int.parse('abcdefg')

expect AssertException
    assert 0 > 1

ints = [1,2,3] 
expect ArgumentOutOfRangeException, print ints[5]


expect MyInvalidInputException
    checkInput(GenericInvalidInputObject)

Notes