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))
})
toscm/toscutil documentation built on Feb. 23, 2025, 2:20 p.m.