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 Sept. 20, 2024, 5:08 p.m.