R/expect-setequal.R
expect_setequal.Rdexpect_setequal(x, y) tests that every element of x occurs in y,
and that every element of y occurs in x.
expect_mapequal(x, y) tests that x and y have the same names, and
that x[names(y)] equals y.
expect_setequal(object, expected) expect_mapequal(object, expected)
| 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. |
Note that expect_setequal() ignores names, and you will be warned if both
object and expected have them.
#> Failed expectation: #> rev(letters)[26] absent from letters[-1]x <- list(b = 2, a = 1) expect_mapequal(x, list(a = 1, b = 2)) show_failure(expect_mapequal(x, list(a = 1)))#> Failed expectation: #> Names absent from `expected`: "b",#> Failed expectation: #> act$val[exp_nms] (`actual`) not equal to exp$val (`expected`). #> #> `actual$b` is a double vector (2) #> `expected$b` is a character vector ('x')#> Failed expectation: #> Names absent from `object`: "c",