tests/testthat/test-warnings.R

context("Warnings")

test_that("Routing to errors and 404s works", {
  r <- pr(test_path("files/warn.R"))

  res <- plumber:::PlumberResponse$new("json")

  expect_equal(options("warn")[[1]], 0)
  expect_warning(r$route(make_req("GET", "/warning"), res), "this is a warning")
  expect_equal(res$status, 1)
  expect_equal(options("warn")[[1]], 0)
})

Try the plumber package in your browser

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

plumber documentation built on Sept. 7, 2022, 1:05 a.m.