tests/testthat/test-render-r.R

library(rmarkdown)


skip_if_not(rmarkdown::pandoc_available())
skip_if_not(pandoc_version() >= numeric_version("2"))

source("utils.R")

str <- c(
  "#' ---",
  "#' output: officedown::rdocx_document",
  "#' ---",
  "",
  "mtcars",
  ""
)
filename <- tempfile(fileext = ".R")
writeLines(str, filename, useBytes = TRUE)

test_that("rendering R file", {
  docx_file <- tempfile(fileext = ".docx")
  expect_true(render_rmd(filename, output_file = docx_file))
})

Try the officedown package in your browser

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

officedown documentation built on Sept. 3, 2023, 1:07 a.m.