From 3e53a2a0896c33e09acb2646b8147471065275f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 17 Dec 2023 04:50:17 +0100 Subject: [PATCH] Fix checks for R < 4.0 --- R/spec-meta-bind.R | 2 +- tests/testthat/helper-dev.R | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/R/spec-meta-bind.R b/R/spec-meta-bind.R index e32ec1373..1cfe2a346 100644 --- a/R/spec-meta-bind.R +++ b/R/spec-meta-bind.R @@ -546,7 +546,7 @@ spec_meta_bind <- list( res <- NULL } }, - bind_character_escape = function(ctx, con) { + bind_character_escape = if (getRversion() >= "4.0") function(ctx, con) { placeholder_funs <- get_placeholder_funs(ctx) is_null_check <- ctx$tweaks$is_null_check for (placeholder_fun in placeholder_funs) { diff --git a/tests/testthat/helper-dev.R b/tests/testthat/helper-dev.R index 1008446ae..6ff09908e 100644 --- a/tests/testthat/helper-dev.R +++ b/tests/testthat/helper-dev.R @@ -59,6 +59,12 @@ inline_meta_tests <- function() { text <- trimws(format(cs$code), "right") text[[1]] <- paste0("spec_meta_bind <- ", text[[1]]) + # Hack + text <- gsub( + "bind_character_escape = ", + 'bind_character_escape = if (getRversion() >= "4.0") ', + text + ) text <- c( "# Generated by helper-dev.R, do not edit by hand", "",