From 321a1ab46d7d02771ab9341acd45c00b83b9c472 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Nov 2026 14:08:35 +0000 Subject: [PATCH 1/3] Initial plan From 3006fe108e524237cd1d43935051f13488ed520b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Nov 2026 14:11:09 +0000 Subject: [PATCH 2/3] Strengthen captured condition tests Co-authored-by: bms63 <10111024+bms63@users.noreply.github.com> --- tests/testthat/test-interact.R | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tests/testthat/test-interact.R b/tests/testthat/test-interact.R index c9908c2..9502880 100644 --- a/tests/testthat/test-interact.R +++ b/tests/testthat/test-interact.R @@ -115,29 +115,36 @@ test_that("setting path name works", { log_remove() }) -test_that("run_safely_loudly works for warnings, errors, messages, and output", { +test_that("run_safely_loudly captures output, messages, warnings, and errors separately", { fp <- test_path("ref", "safely_loudly_test_file.R") log_config(file = fp) run_safely_loudly(fp) - expect_true(!is.null(getOption("log.rx")[["warnings"]])) - expect_true(!is.null(getOption("log.rx")[["errors"]])) - expect_true(!is.null(getOption("log.rx")[["messages"]])) - expect_true(!is.null(getOption("log.rx")[["output"]])) + log <- getOption("log.rx") + expect_identical(log[["output"]], "[1] \"log print\"\n[1] \"log print 2\"\nlog catlog cat 2") + expect_identical( + log[["messages"]], + c("log inform", "log inform 2", "log message", "log message 2") + ) + expect_identical(log[["warnings"]], c("log warning", "log warning2")) + expect_identical(log[["errors"]][["message"]], "log error") log_remove() }) -test_that("run_safely_loudly works for result", { +test_that("run_safely_loudly captures the value returned by the script", { fp <- test_path("ref", "safely_loudly_test_file_result.R") log_config(file = fp) run_safely_loudly(fp) - expect_true(!is.null(getOption("log.rx")[["result"]])) + expect_equal( + getOption("log.rx")[["result"]][["value"]], + data.frame(test = c(8, 6, 7, 5, 3, 0, 9)) + ) log_remove() }) From 570edf3043dc5a18712a82b7b0eb53ee04e11e62 Mon Sep 17 00:00:00 2001 From: bms63 <10111024+bms63@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:34:24 +0000 Subject: [PATCH 3/3] Fix captured message assertions Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- tests/testthat/test-interact.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-interact.R b/tests/testthat/test-interact.R index 9502880..bcfa539 100644 --- a/tests/testthat/test-interact.R +++ b/tests/testthat/test-interact.R @@ -126,7 +126,7 @@ test_that("run_safely_loudly captures output, messages, warnings, and errors sep expect_identical(log[["output"]], "[1] \"log print\"\n[1] \"log print 2\"\nlog catlog cat 2") expect_identical( log[["messages"]], - c("log inform", "log inform 2", "log message", "log message 2") + c("log inform", "log inform 2", "log message\n", "log message 2\n") ) expect_identical(log[["warnings"]], c("log warning", "log warning2")) expect_identical(log[["errors"]][["message"]], "log error")