(v3.0.1.9114) Fix errors without cli and on R 3.0, and make the tinytest pipeline actually run the unit tests

Package:
- stop_() called cli::ansi_has_hyperlink_support() before checking that cli is available, so without cli every error became "there is no package called 'cli'"
- interpretive_rules() failed on R 3.0 for guidelines without AmpC rules (assignment to zero rows)
- Guard the ggplot2 example of wisca_plot()

CI:
- check-old: R 3.0 could not install tinytest over HTTPS, so no unit tests ran; install it with curl, and fail when tinytest is missing or any test fails
- tinytest shim: record expectations in the test file environment, support skips and errors per test_that() block, add missing testthat equivalents, source helper files
- Add R 4.0 (oldrel-6) to check-old, and oldrel-5 to check-recent
This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2026-10-10 14:54:15 +02:00
1 parent f0699c6584
commit 9e609dae83
13 files changed
+68 -32

No files matched your search

+3 -3
View File
@@ -650,10 +650,10 @@ stop_ <- function(...,
}
# prevent errors with single opening curly brackets, we don't evaluate cli's/glue's {} in AMR anyway
msg <- gsub("\\{(?!\\.)", "", msg, perl = TRUE)
if (!cli::ansi_has_hyperlink_support()) {
msg <- simplify_help_markup(msg)
}
if (has_cli_rlang()) {
if (!cli::ansi_has_hyperlink_support()) {
msg <- simplify_help_markup(msg)
}
if (isTRUE(call)) {
call_obj <- sys.call(-1)
} else if (!isFALSE(call)) {
+3 -1
View File
@@ -214,7 +214,9 @@
#' syndromic_group = "ward"
#' )
#' out
#' wisca_plot(out)
#' if (requireNamespace("ggplot2")) {
#' wisca_plot(out)
#' }
#'
#' # stratified using grouped tibbles (e.g. by age and gender)
#' if (requireNamespace("dplyr")) {
+4 -2
View File
@@ -663,8 +663,10 @@ interpretive_rules <- function(x,
if (isTRUE(ampc_cephalosporin_resistance)) {
ampc_cephalosporin_resistance <- "R"
}
if (!is.null(interpretive_rules_df$reference.rule)) {
interpretive_rules_df[which(interpretive_rules_df$reference.rule %like% "ampc"), "to_value"] <- as.character(ampc_cephalosporin_resistance)
# old R versions (at least 3.0) give an error when assigning to no rows of a data.frame without rows
ampc_rows <- if (is.null(interpretive_rules_df$reference.rule)) integer(0) else which(interpretive_rules_df$reference.rule %like% "ampc")
if (length(ampc_rows) > 0) {
interpretive_rules_df[ampc_rows, "to_value"] <- as.character(ampc_cephalosporin_resistance)
}
}