expect_setequal: Does code return a vector containing the expected values?

Description Usage Arguments Details Examples

View source: R/expect-setequal.R

Description

Usage

1
2
3
expect_setequal(object, expected)

expect_mapequal(object, expected)

Arguments

object

Computation and value to compare it to.

Both arguments supports limited unquoting to make it easier to generate readable failures within a function or for loop. See quasi_label for more details.

expected

Computation and value to compare it to.

Both arguments supports limited unquoting to make it easier to generate readable failures within a function or for loop. See quasi_label for more details.

Details

Note that expect_setequal() ignores names, and you will be warned if both object and expected have them.

Examples

1
2
3
4
5
6
7
8

Example output

Failed expectation:
rev(letters)[26] absent from letters[-1]
Failed expectation:
Names absent from `expected`: "b", 
Failed expectation:
act$val[exp_nms] not equal to exp$val.
Component "b": Modes: numeric, character
Component "b": target is numeric, current is character
Failed expectation:
Names absent from `object`: "c", 

testthat documentation built on Oct. 4, 2021, 9:07 a.m.