library(parallel)
library(yaplr)
library(testthat)
context("User-side automatic initialization")
suppressWarnings(yaplr:::shutdown_client())
yaplr:::shutdown_server()
yaplr:::reset_communication()
test_that("Server start and stop", {
expect_warning(yaplr:::shutdown_client(), regexp='Client was not initialized anyway, no need to shut down')
expect_error(yaplr:::init_client(), regexp='Cannot initialize client before initialization of the server')
expect_false(is_server_running())
expect_error(make_sure_server_is_started(server_type = 'non-existant'), regexp = 'Server type can either be')
# debugonce(make_sure_server_is_started)
expect_message(ans<-make_sure_server_is_started(), regexp = 'Server process spawned')
expect_true(ans)
# debugonce(ping_server)
expect_true(is_server_initialized())
expect_true(is_server_running())
ans<-ping_server()
expect_true(ans)
#debugonce(make_sure_server_is_started)
ans<-make_sure_server_is_started()
expect_false(ans)
ans<-make_sure_server_is_down()
expect_true(ans)
ans<-make_sure_server_is_down()
expect_false(ans)
invisible(NULL)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.