tests/testthat/test_default_functions.R

context("default_functions")


test_that("default_functions works as expected", {
  lg <- get_logger("a/test/logger")
  lg$set_exception_handler(function(e) e)

  x <- lg$info(stop("blahblah"))
  expect_warning(default_exception_handler(x), class = "LoggerWarning")

  x$appender <- AppenderConsole$new()
  expect_warning(default_exception_handler(x), class = "AppenderWarning")
  expect_warning(default_exception_handler(x), class = "LoggerWarning")
})

Try the lgr package in your browser

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

lgr documentation built on Sept. 6, 2022, 1:05 a.m.