Skip to content

Expectation::toThrowMatching ​

Member of Expectation

idl
Expectation.toThrowMatching, regex, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, $
  /_expect_failure, $
  _ref_extra = value, $
  /debug, $
  /is_function

Verifies that running a routine or object method raises an error whose message matches a regular expression. The routine is specified and called as described for idl toThrow.

Examples ​

idl
(it.expects('my_pro')).toThrowMatching, 'not (found|exist)', badInput
(it.expects('my_function')).toThrowMatching, 'not (found|exist)', badInput, /is_function

Arguments ​

regex ​

requiredinputtype=String

Specify the regular expression the error message must match.

arg1 ​

optionalinputtype=any

Method name (objects) or first argument for the routine.

arg2 ​

optionalin or outtype=any

Optional argument 2 for the routine or method.

arg3 ​

optionalin or outtype=any

Optional argument 3 for the routine or method.

arg4 ​

optionalin or outtype=any

Optional argument 4 for the routine or method.

arg5 ​

optionalin or outtype=any

Optional argument 5 for the routine or method.

arg6 ​

optionalin or outtype=any

Optional argument 6 for the routine or method.

arg7 ​

optionalin or outtype=any

Optional argument 7 for the routine or method.

arg8 ​

optionalin or outtype=any

Optional argument 8 for the routine or method.

arg9 ​

optionalin or outtype=any

Optional argument 9 for the routine or method.

Keywords ​

_expect_failure {#kw-_expect_failure} ​

optionalinputtype=Boolean

If the test fails for some reason, set this to force passing because we expected failure. This is an internal keyword and should not be used.

_ref_extra {#kw-_ref_extra} ​

optionalinputtype=any

All other keywords are passed to the routine or method.

debug ​

optionalinputtype=Boolean

If set, errors are not caught to make debugging easier.

is_function ​

optionalinputtype=Boolean

Set if the routine or method is a function. By default, the routine or method is a procedure.

Licensed under MIT.