1
2context("messages")
3
4test_that("messages in callr::r do not crash session", {
5  ret <- r(function() { cli::cli_text("fooobar"); 1 + 1 })
6  expect_identical(ret, 2)
7  gc()
8})
9
10test_that("messages in callr::r_bg do not crash session", {
11  skip_in_covr()  # TODO: what wrong with this on Windows?
12  skip_on_cran()
13
14  rx <- r_bg(function() { cli::cli_text("fooobar"); 1 + 1 })
15  rx$wait(5000)
16  rx$kill()
17  expect_equal(rx$get_exit_status(), 0)
18
19  expect_equal(rx$get_result(), 2)
20  processx::processx_conn_close(rx$get_output_connection())
21  processx::processx_conn_close(rx$get_error_connection())
22  gc()
23})
24