/usr/share/doc/r-cran-withr/tests/testthat/test-wrap.R is in r-cran-withr 2.1.0-1ubuntu3.
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 | context("wrap")
test_that("wrap works", {
v <- c(0, 0, 0)
set <- function(x) v[2] <<- x
f <- wrap(set, v[1] <<- v[1] + 1, v[3] <<- v[3] + 3)
expect_equal(v, c(0, 0, 0))
f(2)
expect_equal(v, 1:3)
})
|