Skip to content

Commit

Permalink
warn
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Dec 17, 2023
1 parent 48f959d commit e5a949e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
13 changes: 6 additions & 7 deletions R/spec-meta-bind-expr.R
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,12 @@ spec_meta_bind_expr <- list(
bind_factor = function(ctx, con) {
#' - [factor] (bound as character,
#' with warning)
suppressWarnings(expect_warning(
test_select_bind(
con,
ctx,
lapply(c(get_texts(), NA_character_), factor)
)
))
test_select_bind(
con,
ctx,
lapply(c(get_texts(), NA_character_), factor),
warn = TRUE
)
},

bind_date = function(ctx, con) {
Expand Down
6 changes: 5 additions & 1 deletion R/spec-meta-bind-runner.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ run_bind_tester$fun <- function(
check_return_value = NULL,
patch_bind_values = NULL,
bind_error = NA,
warn = FALSE,
is_repeated = FALSE,
is_premature_clear = FALSE,
is_untouched = FALSE) {
Expand Down Expand Up @@ -145,7 +146,10 @@ run_bind_tester$fun <- function(
#' a list.
#' The parameter list is passed to a call to `dbBind()` on the `DBIResult`
#' object.
bind_expr <- if (is.na(bind_error)) rlang::expr({
bind_expr <- if (isTRUE(warn)) rlang::expr({
bind_res <- withVisible(suppressWarnings(expect_warning(dbBind(res, bind_values_patched))))
!!check_return_value_expr
}) else if (is.na(bind_error)) rlang::expr({
bind_res <- withVisible(dbBind(res, bind_values_patched))
!!check_return_value_expr
}) else rlang::expr({
Expand Down
13 changes: 6 additions & 7 deletions R/spec-meta-bind.R
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,12 @@ spec_meta_bind <- list(
},

bind_factor = function(ctx, con) {
suppressWarnings(expect_warning(
test_select_bind(
con,
ctx,
lapply(c(get_texts(), NA_character_), factor)
)
))
test_select_bind(
con,
ctx,
lapply(c(get_texts(), NA_character_), factor),
warn = TRUE
)
},

bind_date = function(ctx, con) {
Expand Down

0 comments on commit e5a949e

Please sign in to comment.