tests/testthat/test-progress.R

context("Garbage collection")

test_that("callbacks are protected", {
  progress <- function(down, up) { TRUE }
  h <- new_handle(progressfunction = progress, noprogress = FALSE)
  rm(progress)
  gc()
  res <- curl_fetch_memory("https://cloud.r-project.org/web/packages/curl/curl.pdf", handle = h)
  expect_equal(res$status, 200)
  expect_equal(total_handles(), 1L)
  rm(h)
  gc()
  expect_equal(total_handles(), 0L)
})

Try the curl package in your browser

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

curl documentation built on Oct. 2, 2023, 5:06 p.m.