tests/testthat/test-quitely_run.R

test_that("quietly_run suppresses warnings", {

  warning_func_arugment <- function(info) {
    warning(info)
    return("Complete")
  }

  expect_warning(warning_func_arugment("Just checking"))

  result <- quietly_run(warning_func_arugment, "Just checking")

  expect_silent(result)

})

test_that("quietly_run suppresses errors", {

  message_func_no_argument <- function() {
    warning("Error!")
  }

  expect_warning(message_func_no_argument())

  result <- quietly_run(message_func_no_argument)

  expect_silent(result)

})

Try the vvshiny package in your browser

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

vvshiny documentation built on July 26, 2023, 5:50 p.m.