tests/testthat/test-populate.R

context("populate")

test_that("can populate existing env", {
  env <- new.env(parent = emptyenv())
  populate_env(env, letters, identity)
  expect_equal(env$a, quote(a))
  expect_equal(env$k, quote(k))
  expect_null(env$Z)
})

test_that("cannot update existing vars", {
  env <- new.env(parent = emptyenv())
  populate_env(env, "v", identity)
  expect_error(populate_env(env, letters, identity), "existing")
})

Try the bindr package in your browser

Any scripts or data that you put into this service are public.

bindr documentation built on May 2, 2019, 4:22 a.m.