From 9b4e610f1ae8f753793bbeec64b4a592e46e03d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 17 Dec 2023 19:03:38 +0100 Subject: [PATCH] SNAPSHOT --- R/spec-result-roundtrip.R | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/R/spec-result-roundtrip.R b/R/spec-result-roundtrip.R index 16cef9d3b..1ff19a547 100644 --- a/R/spec-result-roundtrip.R +++ b/R/spec-result-roundtrip.R @@ -75,6 +75,9 @@ spec_result_roundtrip <- list( data_date_current = function(ctx, con) { #' (also applies to the return value of the SQL function `current_date`) + # FIXME: Turn into two checks, each with a separate skip + # depending on the tweak, to avoid mangling the query at run time + # Same with current_time and current_timestamp test_select_with_null( .ctx = ctx, con, "current_date" ~ is_roughly_current_date @@ -273,6 +276,7 @@ test_select <- function( # Run time .ctx, .envir = parent.frame()) { + values <- list2(...) value_is_formula <- map_lgl(values, is.call) @@ -290,12 +294,16 @@ test_select <- function( sql_values <- names(values) } - if (isTRUE(.ctx$tweaks$current_needs_parens)) { - sql_values <- gsub( - "^(current_(?:date|time|timestamp))$", "\\1()", - sql_values - ) - } + sql_values_expr <- expr({ + sql_values <- !!construct_expr(sql_values) + + if (isTRUE(.ctx$tweaks$current_needs_parens)) { + sql_values <- gsub( + "^(current_(?:date|time|timestamp))$", "\\1()", + sql_values + ) + } + }) sql_names <- letters[seq_along(sql_values)]