Skip to content

Expectation::toHaveLength ​

Member of Expectation

idl
Expectation.toHaveLength, length, $
  /_expect_failure

Verifies that the expectation value has a number of elements. Arrays and strings use idl n_elements() while lists, hashes, orderedhashes and dictionaries use their item count.

Examples ​

idl
(it.expects(findgen(100))).toHaveLength, 100
(it.expects(list(1, 2))).toHaveLength, 2
(it.expects(hash('a', 1)))._not_.toHaveLength, 2

Arguments ​

length ​

requiredinputtype=Int

Specify the number of elements expected, zero or greater.

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 keyword is for internal use only.

Licensed under MIT.