Skip to content

Commit

Permalink
rationalize tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Oct 12, 2024
1 parent 5257304 commit 8b625ce
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions tests/tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,20 @@ connection && {
Sys.sleep(1L)
test_equal(1L, d <- daemons(1L, dispatcher = FALSE, asyncdial = FALSE, seed = 1546L))
test_print(d)
me <- mirai(mirai::mirai(), .timeout = 2000L)
if (!is_mirai_error(call_mirai(me)$data)) test_true(is_error_value(me$data))
if (is_mirai_error(me$data)) test_type("list", me$data$stack.trace)
test_true(!is_mirai_interrupt(me$data))
test_class("errorValue", me[["data"]])
me <- mirai(mirai::mirai(), .timeout = 2000L)[]
if (!is_mirai_error(me)) test_true(is_error_value(me))
if (is_mirai_error(me)) test_type("list", me$stack.trace)
if (is_mirai_error(me)) test_true(length(me$stack.trace) >= 2L)
if (is_mirai_error(me)) test_true(all(as.logical(lapply(me$stack.trace, is.character))))
test_true(!is_mirai_interrupt(me))
test_class("errorValue", me)
test_print(me)
test_print(me$data)
err <- mirai(func("stopped"), func = function(x) stop(x), .timeout = 2000L)[]
if (is_mirai_error(err)) test_type("list", err$stack.trace)
if (is_mirai_error(err)) test_true(all(as.logical(lapply(err$stack.trace, is.character))))
if (is_mirai_error(err)) test_true(length(err$stack.trace) >= 2L)
df <- data.frame(a = 1, b = 2)
dm <- mirai(as.matrix(df), .args = list(df = df), .timeout = 2000L)
test_true(is_mirai(call_mirai(dm)))
test_true(!unresolved(dm))
if (!is_error_value(dm$data)) test_class("matrix", dm$data)
test_print(dm)
test_type("integer", status()[["connections"]])
test_type("character", status()[["daemons"]])
test_type("character", mlc <- launch_remote("ws://[::1]:5555"))
Expand Down

0 comments on commit 8b625ce

Please sign in to comment.