inst/templates/test-demo.R

## Test demo ----

test_that("Test demo", {
  expect_invisible(print_msg())
  
  x <- print_msg()
  expect_equal(x, "Hello world")
  
  x <- print_msg("Bonjour le monde")
  expect_equal(x, "Bonjour le monde")
  
  expect_error(print_msg(c("Hello", "world")))
  expect_error(print_msg(1), "Argument 'x' must be a character of length 1.")
})

Try the rcompendium package in your browser

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

rcompendium documentation built on Oct. 26, 2023, 5:08 p.m.