expect_equal

Here a simple example.

complicated_object <- list(
  x = list(mtcars, iris),
  y = 10
)
expect_equal(complicated_object$y, 10)

The most popular cases of expect equal.

Dedicated function Equivalent expression
expect_true(x) expect_equal(x, TRUE)
expect_false(x) expect_equal(x, FALSE)
expect_null(x) expect_equal(x, NULL)
expect_length(x, 10) expect_equal(length(x), 10)
expect_named(x, c("a", "b", "c")) expect_equal(names(x), c("a", "b", "c"))


expect_named() also has the ignore.order and ignore.case arguments.