expect_length: Expectation: does a vector have the specified length?

Description Usage Arguments See Also Examples

View source: R/expect-length.R

Description

Expectation: does a vector have the specified length?

Usage

1
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

Other expectations: comparison-expectations, equality-expectations, expect_match, expect_named, expect_null, inheritance-expectations, logical-expectations, output-expectations

Examples

1
2
3
4
5
6
7
expect_length(1, 1)
expect_length(1:10, 10)

## Not run: 
expect_length(1:10, 1)

## End(Not run)

r-lib/testthat documentation built on May 1, 2019, 8:14 a.m.