/usr/share/doc/r-cran-rlang/tests/testthat/test-events.R is in r-cran-rlang 0.2.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | context("events")
test_that("can't add an exit event at top-level", {
expect_true(TRUE)
# This can only be tested interactively
if (FALSE) {
scoped_exit(1) # Can't add an exit event at top level
}
})
test_that("can add an exit event within a non-top-level global frame", {
local(envir = global_env(), {
`_x` <- list()
rlang:::scoped_exit(`_x` <- c(`_x`, "bar"))
`_x` <- c(`_x`, "foo")
})
expect_identical(env_get(global_env(), "_x"), list("foo", "bar"))
env_unbind(global_env(), "_x")
})
|