tests/testthat/test-local_.R
raw| 1 | test_that("works without withr attached", { |
| 2 | |
| 3 | expect_no_error(callr::r( |
| 4 | function() { |
| 5 | get_options <- function(...) { |
| 6 | do.call(options, as.list(names(list(...)))) |
| 7 | } |
| 8 | set_options <- function(...) { |
| 9 | options(...) |
| 10 | } |
| 11 | |
| 12 | withr::local_(set_options, new = FALSE)(x = 1) |
| 13 | withr::local_(set_options, get = get_options, new = FALSE)(y = 2) |
| 14 | } |
| 15 | )) |
| 16 | |
| 17 | }) |