From f20460ddb602eb8f01aea2aa2aa05668717b387d Mon Sep 17 00:00:00 2001 From: jgabry Date: Tue, 30 Dec 2025 09:15:56 -0700 Subject: [PATCH 1/2] Fix error message after data.table change --- tests/testthat/test-csv.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-csv.R b/tests/testthat/test-csv.R index dc678a6bc..4f2aec4da 100644 --- a/tests/testthat/test-csv.R +++ b/tests/testthat/test-csv.R @@ -85,7 +85,8 @@ test_that("read_cmdstan_csv() fails with empty csv file", { file_path <- test_path("resources", "csv", "empty.csv") file.create(file_path) expect_error(read_cmdstan_csv(file_path), - "Supplied CSV file is corrupt!") + "External command failed", + fixed = TRUE) file.remove(file_path) }) From 36d76f1a7a010f541fb479f56ef2507f7b01d989 Mon Sep 17 00:00:00 2001 From: jgabry Date: Tue, 30 Dec 2025 11:56:21 -0700 Subject: [PATCH 2/2] condition on data.table version when checking error message --- tests/testthat/test-csv.R | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test-csv.R b/tests/testthat/test-csv.R index 4f2aec4da..2d7513aa0 100644 --- a/tests/testthat/test-csv.R +++ b/tests/testthat/test-csv.R @@ -84,9 +84,12 @@ test_that("read_cmdstan_csv() fails if the file does not exist", { test_that("read_cmdstan_csv() fails with empty csv file", { file_path <- test_path("resources", "csv", "empty.csv") file.create(file_path) - expect_error(read_cmdstan_csv(file_path), - "External command failed", - fixed = TRUE) + error_msg <- if (utils::packageVersion("data.table") >= "1.18.0") { + "External command failed" + } else { + "Supplied CSV file is corrupt" + } + expect_error(read_cmdstan_csv(file_path), error_msg, fixed = TRUE) file.remove(file_path) })