Skip to content

Commit 36d76f1

Browse files
committed
condition on data.table version when checking error message
1 parent f20460d commit 36d76f1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/testthat/test-csv.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,12 @@ test_that("read_cmdstan_csv() fails if the file does not exist", {
8484
test_that("read_cmdstan_csv() fails with empty csv file", {
8585
file_path <- test_path("resources", "csv", "empty.csv")
8686
file.create(file_path)
87-
expect_error(read_cmdstan_csv(file_path),
88-
"External command failed",
89-
fixed = TRUE)
87+
error_msg <- if (utils::packageVersion("data.table") >= "1.18.0") {
88+
"External command failed"
89+
} else {
90+
"Supplied CSV file is corrupt"
91+
}
92+
expect_error(read_cmdstan_csv(file_path), error_msg, fixed = TRUE)
9093
file.remove(file_path)
9194
})
9295

0 commit comments

Comments
 (0)