tests/testthat/test-function_defaults.R

test_that("default values of a function can be returned", {
  f <- function(a, b = 1, c = "", ...) { }
  expect_equal(
    function_defaults(f),
    list(b = 1, c = "")
  )
  expect_equal(
    function_defaults(f, exclude = "b"),
    list(c = "")
  )
})

Try the oeli package in your browser

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

oeli documentation built on Oct. 16, 2024, 5:08 p.m.