mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-14 01:18:07 -05:00
26 lines
507 B
R
26 lines
507 B
R
context("timer")
|
|
|
|
test_that("Scheduling works", {
|
|
ran <- FALSE
|
|
fun <- function() {
|
|
ran <<- TRUE
|
|
}
|
|
|
|
timerCallbacks$schedule(500, fun)
|
|
|
|
timerCallbacks$executeElapsed()
|
|
expect_false(ran)
|
|
|
|
Sys.sleep(0.1)
|
|
timerCallbacks$executeElapsed()
|
|
expect_false(ran)
|
|
|
|
Sys.sleep(0.5)
|
|
expect_true(timerCallbacks$executeElapsed())
|
|
expect_true(ran)
|
|
|
|
# Empty timerCallbacks should return FALSE
|
|
expect_false(timerCallbacks$executeElapsed())
|
|
expect_equal(0, nrow(timerCallbacks$takeElapsed()))
|
|
})
|