Skip to content

Expectation::toBeA ​

Member of Expectation

idl
Expectation.toBeA, type, $
  /_expect_failure

Expectation test that makes sure an expectation value matches the type or array of types specified.

  • string
  • number
  • file
  • null
  • scalar
  • array
  • boolean
  • complex
  • float
  • integer
  • object

And you can specify any other value that works with IDL's idl isa() function.

Examples ​

idl
(it.expects(42)).toBeA, 'number'
(it.expects(42)).toBeA, ['number', 'long']

(it.expects([42, 42])).toBeA, ['number', 'long', 'array']
(it.expects([42, 42]))._not_.toBeA, ['string', 'array']

p = plot(/buffer, /test)
(it.expects(p)).toBeA, 'plot'
(it.expects(p)).toBeA, ['plot', 'object']

Arguments ​

type ​

requiredinputtype=String | Array<String>

Specify a type or array of types that an expectation value should have.

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.