File: test-progress.R

package info (click to toggle)
r-cran-curl 4.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 740 kB
  • sloc: ansic: 2,674; sh: 11; makefile: 5
file content (14 lines) | stat: -rw-r--r-- 420 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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)
})