View source: R/expect-setequal.R
expect_setequal | R Documentation |
expect_setequal(x, y)
tests that every element of x
occurs in y
,
and that every element of y
occurs in x
.
expect_contains(x, y)
tests that x
contains every element of y
(i.e. y
is a subset of x
).
expect_in(x, y)
tests every element of x
is in y
(i.e. x
is a subset of y
).
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)
expect_contains(object, expected)
expect_in(object, expected)
object , 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.
expect_setequal(letters, rev(letters))
show_failure(expect_setequal(letters[-1], rev(letters)))
x <- list(b = 2, a = 1)
expect_mapequal(x, list(a = 1, b = 2))
show_failure(expect_mapequal(x, list(a = 1)))
show_failure(expect_mapequal(x, list(a = 1, b = "x")))
show_failure(expect_mapequal(x, list(a = 1, b = 2, c = 3)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.