expect_length {testthat} | R Documentation |
Does code return a vector with the specified length?
Description
Does code return a vector with the specified length?
Usage
expect_length(object, n)
Arguments
object |
Object to test. Supports limited unquoting to make it easier to generate readable failures within a function or for loop. See quasi_label for more details. |
n |
Expected length. |
See Also
expect_vector()
to make assertions about the "size" of a vector
Other expectations:
comparison-expectations
,
equality-expectations
,
expect_error()
,
expect_match()
,
expect_named()
,
expect_null()
,
expect_output()
,
expect_reference()
,
expect_silent()
,
inheritance-expectations
,
logical-expectations
Examples
expect_length(1, 1)
expect_length(1:10, 10)
## Not run:
expect_length(1:10, 1)
## End(Not run)
[Package testthat version 3.2.1.1 Index]