tests/testthat/test-chk-array.R

test_that("vld_array", {
  expect_false(vld_array(1))
  expect_true(vld_array(array()))
  expect_true(vld_array(array(NA)))
  expect_true(vld_array(array(1)))
})

test_that("chk_array", {
  expect_identical(chk_array(array(1)), array(1))
  expect_invisible(chk_array(array(1)))
  expect_chk_error(
    chk_array(1),
    "^`1` must be an array[.]$"
  )
})

Try the chk package in your browser

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

chk documentation built on Oct. 6, 2023, 9:06 a.m.