Skip to content

Expectation::toRunFunctionMethod ​

Member of Expectation

idl
Expectation.toRunFunctionMethod, method, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, $
  /_expect_failure, $
  _ref_extra = value, $
  /debug, $
  output = value, $
  /time

Verifies that the expectation value is an object and can run the specified function method with the provided arguments/keywords.

Note that, if you need to test a static method, you can use one of the two following approaches:

idl
(it.expects('execute')).toRunFunction, 'someObj.staticMethod()'
(it.expects(1)).toEqual, execute('someObj.staticMethod()')

Examples ​

idl
; create an object
e = it.expects(plot(/test, /buffer))

; run a function method and keep the result
e.toRunFunctionMethod, 'copyWindow', output = value

; verify result
(it.expects(value))._not_.toBeNull

Arguments ​

method ​

requiredinputtype=String

Specify the method that you want to run.

arg1 ​

optionalinputtype=any

First argument passed on to the method being called.

arg2 ​

optionalinputtype=any

Second argument passed on to the method being called.

arg3 ​

optionalinputtype=any

Third argument passed on to the method being called.

arg4 ​

optionalinputtype=any

Fourth argument passed on to the method being called.

arg5 ​

optionalinputtype=any

Fifth argument passed on to the method being called.

arg6 ​

optionalinputtype=any

Sixth argument passed on to the method being called.

arg7 ​

optionalinputtype=any

Seventh argument passed on to the method being called.

arg8 ​

optionalinputtype=any

Eighth argument passed on to the method being called.

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 specified keywords will be passed to the method that is being called.

debug ​

optionalinputtype=Boolean

If set, errors in the procedure/function will be stopped on to make it easier to debug errors.

output ​

optionaloutputtype=any

Keyword that contains the result of running the function and can be useful to verify the return value.

time ​

optionalinputtype=Boolean

If set, the time to run the function will be added to the test summary. Note that this is different from profiling the tests and only times this specific function call.

Licensed under MIT.