tests/testthat/test-arg.R

test_that("deprecated() returns the missing argument", {
  fn <- function(foo = deprecated()) is_present(foo)
  expect_false(fn())
  expect_true(fn(1))

  fn <- function(foo) is_present(foo)
  expect_false(fn())
  expect_true(fn(1))
})

Try the lifecycle package in your browser

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

lifecycle documentation built on Nov. 7, 2023, 5:06 p.m.