Expectation::toBeTruthy
Member of Expectation
idl
Expectation.toBeTruthy, $
/_expect_failureVerifies that the expectation value is truthy. Unlike idl toBeTrue this does not require a scalar and does not raise an error when no value is set. A value is truthy if it is:
- a non-empty string
- a non-zero number
- a valid pointer or object reference (lists, hashes, orderedhashes and dictionaries must also have at least one element)
- a structure
- an array
Anything else, including a missing value (!null), is falsy.
Examples
idl
(it.expects('text')).toBeTruthy
(it.expects(2)).toBeTruthy
(it.expects(list(1))).toBeTruthy
(it.expects(''))._not_.toBeTruthyKeywords
_expect_failure {#kw-_expect_failure}
optionalinputtype=BooleanIf the test fails for some reason, set this to force passing because we expected failure. This keyword is for internal use only.