| 1 |
checkAndGetResults <- function(isError, isStopped) { |
| 2 |
stopifnot(shiny:::.globals$reterror == isError) |
| 3 |
stopifnot(shiny:::.globals$stopped, isStopped) |
| 4 |
shiny:::.globals$retval |
| 5 |
} |
| 6 |
|
| 7 |
test_that("stopApp records errors and respects visibility", { |
| 8 |
|
| 9 |
stopApp(10) |
| 10 |
expect_equal(withVisible(10), checkAndGetResults(FALSE, TRUE)) |
| 11 |
|
| 12 |
stopApp(invisible(cars)) |
| 13 |
expect_equal(withVisible(invisible(cars)), checkAndGetResults(FALSE, TRUE)) |
| 14 |
|
| 15 |
stopApp(stop("boom", call. = FALSE)) |
| 16 |
err <- checkAndGetResults(TRUE, TRUE) |
| 17 |
attr(err, "stack.trace") <- NULL |
| 18 |
expect_identical(simpleError("boom"), err) |
| 19 |
}) |