tests/testthat/test-fail-well.R

test_that("Error fails well", {
  skip_on_cran()

  expect_error(Error$new(name = "asdfdf"), "unused argument")

  expect_error(Error$new(a = 5), "unused argument")

  expect_error(Error$new(behavior = 5), "is not TRUE")

  expect_error(Error$new(behavior = "asdfadfs"),
               "'behavior' must be one of stop, warning, or message")
})

Try the fauxpas package in your browser

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

fauxpas documentation built on May 3, 2023, 9:14 a.m.