From ad026d35a422a62e3a07ed624c0495a4f0079df0 Mon Sep 17 00:00:00 2001 From: shikokuchuo <53399081+shikokuchuo@users.noreply.github.com> Date: Mon, 30 Sep 2024 17:05:34 +0100 Subject: [PATCH] add some more tests --- tests/tests.R | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/tests.R b/tests/tests.R index f683bbe1d..242271ed6 100644 --- a/tests/tests.R +++ b/tests/tests.R @@ -78,7 +78,9 @@ test_class("errorValue", raio$data) r <- n$send(data.frame(), block = FALSE) if (r == 8L) r <- n$send(data.frame(), block = 500L) test_zero(r) -test_true(is.data.frame(n1$recv(block = 500))) +r <- n1$recv(block = FALSE) +if (is_error_value(r)) r <- n1$recv(block = 500) +test_class("data.frame", r) test_zero(n1$send(c("test", "", "spec"), mode = "raw", block = 500)) test_identical(n$recv("character", block = 500), c("test", "", "spec")) test_zero(n$send(1:5, mode = "r")) @@ -156,8 +158,10 @@ test_class("nanoListener", n$listener[[2L]]) test_type("double", stat(n$listener[[2L]], "id")) test_zero(n$dial(url = "inproc://four")) test_zero(close(n$listener[[1]])) +test_equal(suppressWarnings(start(n$listener[[1]])), 12L) test_equal(suppressWarnings(close(n$listener[[1]])), 12L) test_zero(close(n1$dialer[[1]])) +test_equal(suppressWarnings(start(n1$dialer[[1]])), 12L) test_equal(suppressWarnings(close(n1$dialer[[1]])), 12L) test_zero(reap(n$listener[[2]])) test_zero(reap(n$dialer[[2]])) @@ -225,7 +229,7 @@ test_type("integer", req$send(data.frame(), mode = "seri", block = 500)) test_class("recvAio", msg <- recv_aio(ctx, mode = "ser", timeout = 500)) test_type("logical", .unresolved(msg)) test_type("logical", unresolved(msg)) -test_true(is.data.frame(call_aio(msg)$data)) +test_class("data.frame", call_aio(msg)$data) test_true(!unresolved(msg)) test_zero(req$send(c(TRUE, FALSE, TRUE), mode = 2L, block = 500)) test_class("recvAio", msg <- recv_aio(ctx, mode = 6L, timeout = 500)) @@ -309,6 +313,7 @@ test_null(req$context) rep$dialer <- NULL test_type("externalptr", rep$dialer[[1L]]) test_zero(close(ctx)) +test_equal(suppressWarnings(close(ctx)), 7L) if (is_nano(p)) test_equal(reap(p), 12L) if (is_nano(p)) test_equal(suppressWarnings(close(p)), 12L)