tests/testthat/test-check_names.R

test_that("Error if names exist but do not match", {
  x <- matrix(1:10, nrow = 2, dimnames = list(c("a", "b"), NULL))
  y <- stats::setNames(1:2, c("a", "c"))
  expect_error(check_names(x, y), "must match")
  y <- 1:2
  expect_silent(check_names(x, y))
})

Try the cpmr package in your browser

Any scripts or data that you put into this service are public.

cpmr documentation built on Oct. 6, 2024, 9:06 a.m.