packrat/lib/x86_64-w64-mingw32/3.4.3/withr/tests/testthat/test-wrap.R

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)
})
UBC-MDS/Karl documentation built on May 22, 2019, 1:53 p.m.