tests/testthat/test-expect-chk-error.R

test_that("expect-chk-error", {
  expect_s3_class(expect_chk_error(chk_flag(1)), "chk_error")
  expect_error(
    expect_chk_error(chk_flag(TRUE)),
    "",
    class = "expectation_failure"
  )
  expect_error(
    expect_chk_error(chk_flag(TRUE), class = "chk_error"),
    "`class` must be NULL."
  )
})

Try the chk package in your browser

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

chk documentation built on Sept. 3, 2026, 9:07 a.m.