tests/testthat/test-object-format.R

test_that("format has nice defaults for bare vectors", {
  if (getRversion() >= "4.0.0") {
    txt <- "test-object-format-r4.txt"
  } else {
    txt <- "test-object-format.txt"
  }
  verify_output(test_path(txt), {
    call_to_format(x <- list(a = 1, b = 2))
    call_to_format(x <- ordered(letters[1:5]))
    call_to_format(x <- diag(10))
    call_to_format(x <- array(1:27, dim = c(3, 3, 3)))
    call_to_format(x <- data.frame(a = 1, b = 2))
  })
})

Try the roxygen2 package in your browser

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

roxygen2 documentation built on Sept. 8, 2021, 9:08 a.m.