Debian Codegraph @

tests/testthat/test-wrap.R

raw
1 test_that("wrap works", {
2 v <- c(0, 0, 0)
3 set <- function(x) v[2] <<- x
4 f <- wrap(set, v[1] <<- v[1] + 1, v[3] <<- v[3] + 3)
5 expect_equal(v, c(0, 0, 0))
6 f(2)
7 expect_equal(v, 1:3)
8 })