tests/testthat/test-password.R

test_that("read file with password", {
  pdf_file <- 'password.pdf'
  expect_type(pdf_compress(pdf_file, tempfile(), TRUE, "userpwd"), "character")
  expect_type(pdf_compress(pdf_file, tempfile(), FALSE, "userpwd"), "character")
  expect_error(pdf_compress(pdf_file, tempfile(), TRUE, 'wrong'))
  expect_error(pdf_compress(pdf_file, tempfile(), TRUE, ""))
  expect_error(pdf_compress(pdf_file, tempfile(), TRUE, " "))
  expect_error(pdf_compress(pdf_file, tempfile(), TRUE, NA))
  expect_error(pdf_compress(pdf_file, tempfile(), TRUE, NULL))
})

Try the cpp11qpdf package in your browser

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

cpp11qpdf documentation built on April 4, 2025, 4:39 a.m.