tests/testthat/test-CommentClass.R

test_that("createComment() works", {
  # error checking
  expect_error(createComment("hi", width = 1), NA)
  expect_error(createComment("hi", width = 1L), NA)
  expect_error(createComment("hi", width = 1:2), "width")
  
  expect_error(createComment("hi", height = 1), NA)
  expect_error(createComment("hi", height = 1L), NA)
  expect_error(createComment("hi", height = 1:2), "height")
  
  expect_error(createComment("hi", visible = NULL))
  expect_error(createComment("hi", visible = c(TRUE, FALSE)), "visible")
  
  expect_error(createComment("hi", author = 1))
  expect_error(createComment("hi", author = c("a", "a")), "author")
  
  expect_s4_class(createComment("hello"), "Comment")
})

Try the openxlsx package in your browser

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

openxlsx documentation built on Feb. 16, 2023, 6:47 p.m.