Wiki
Version 4 (modified by hopscc, 14 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>
    <statements>

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