R/local.R

Defines functions local_mock_env

local_mock_env <- function(mock_env, .parent, env = parent.frame()) {
  old_parent <- parent.env(.parent)
  withr::defer(parent.env(.parent) <- old_parent, env)
  parent.env(.parent) <- mock_env

  invisible()
}

Try the mockr package in your browser

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

mockr documentation built on Feb. 16, 2023, 5:08 p.m.