tests/testthat/test-pool-methods.R

test_that("localCheckout works", {
  pool <- poolCreate(function(x) 1)
  withr::defer(poolClose(pool))

  f <- function() {
    localCheckout(pool)
    checkCounts(pool, free = 0, taken = 1)
  }

  f()
  checkCounts(pool, free = 1, taken = 0)
})

Try the pool package in your browser

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

pool documentation built on March 7, 2023, 6:49 p.m.