tests/testthat/test-stub.R

test_that("stub works", {
  f <- function(x, y = 2, z = 3) x + y + z
  args <- stub(f, x = 1)
  expect_equal(x, 1)
  expect_equal(y, 2)
  expect_equal(z, 3)
  expect_equal(args, list(x = 1, y = 2, z = 3))
})

Try the toscutil package in your browser

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

toscutil documentation built on June 28, 2024, 5:06 p.m.