You can either check for the presence of names (leaving expected
blank), specific names (by supplying a vector of names), or absence of
names (with NULL
).
expect_named( object, expected, ignore.order = FALSE, ignore.case = FALSE, info = NULL, label = NULL )
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. |
---|---|
expected | Character vector of expected names. Leave missing to
match any names. Use |
ignore.order | If |
ignore.case | If |
info | Extra information to be included in the message. This argument is soft-deprecated and should not be used in new code. Instead see alternatives in quasi_label. |
label | Used to customise failure messages. For expert use only. |
Other expectations:
comparison-expectations
,
equality-expectations
,
expect_error()
,
expect_length()
,
expect_match()
,
expect_null()
,
expect_output()
,
expect_reference()
,
expect_silent()
,
inheritance-expectations
,
logical-expectations