tests/testthat/test-xlsx-misc.R

test_that("console printing", {
  x <- read_xlsx()
  expect_output(print(x), regexp = "^xlsx document with 1 sheet")
})

test_that("check extention and print document", {
  x <- read_xlsx()
  print(x, target = "print.xlsx")
  expect_true( file.exists("print.xlsx") )
  expect_error(print(x, target = "print.xlsxxxx"))
})


unlink("*.xlsx")

Try the officer package in your browser

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

officer documentation built on Oct. 10, 2024, 1:06 a.m.