mirror of
https://github.com/rstudio/shiny.git
synced 2026-02-05 12:15:14 -05:00
22 lines
613 B
R
22 lines
613 B
R
context("stop-app")
|
|
|
|
checkAndGetResults <- function(isError, isStopped) {
|
|
stopifnot(shiny:::.globals$reterror == isError)
|
|
stopifnot(shiny:::.globals$stopped, isStopped)
|
|
shiny:::.globals$retval
|
|
}
|
|
|
|
test_that("stopApp records errors and respects visibility", {
|
|
|
|
stopApp(10)
|
|
expect_equal(withVisible(10), checkAndGetResults(FALSE, TRUE))
|
|
|
|
stopApp(invisible(cars))
|
|
expect_equal(withVisible(invisible(cars)), checkAndGetResults(FALSE, TRUE))
|
|
|
|
stopApp(stop("boom", call. = FALSE))
|
|
err <- checkAndGetResults(TRUE, TRUE)
|
|
attr(err, "stack.trace") <- NULL
|
|
expect_identical(simpleError("boom"), err)
|
|
})
|