tests/testthat/test-developer-testing-rtf_convert_format.R

test_that("Report ERROR if libreoffice7.1 is not avaiable", {
  skip_on_cran()
  skip_on_os(c("windows", "mac", "solaris"))
  file <- file.path(tempdir(), "tmp.rtf")
  iris |>
    head() |>
    rtf_body() |>
    rtf_encode() |>
    write_rtf(file)
  if (system("which libreoffice7.1", ignore.stderr = TRUE, ignore.stdout = TRUE) == 1) {
    expect_error(rtf_convert_format(input = file, output_dir = tempdir()))
  } else {
    expect_equal(rtf_convert_format(input = file, output_dir = tempdir()), file.path(tempdir(), "tmp.pdf"))
  }
})

Try the r2rtf package in your browser

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

r2rtf documentation built on Oct. 25, 2023, 9:07 a.m.