-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transition expect_error()
for snowflake backend
#1547
Conversation
* ...to snapshot when testing the error message * ...to classed error when testing an error from another package or an error thrown from a widely-used helper * ...to `expect_no_error()` (or no test) when `regex = NA` * Analogous story for `expect_warning()` and `expect_message()`.
R/utils-check.R
Outdated
@@ -144,7 +144,7 @@ check_unsupported_arg <- function(x, | |||
|
|||
msg <- c(msg, i = allow_msg) | |||
} | |||
cli_abort(msg, call = call) | |||
cli_abort(msg, call = call, class = "unsupported_arg_error") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe include the arg
in the error object too?
I'd make the class start with dbplyr_
. I'm have mixed feelings about including error in the class name (since it seems redundant) but I see that rlang includes it, so best to be conssitent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DavisVaughan suggests using dbplyr_error_...
to match vctrs.
) | ||
expect_snapshot( | ||
error = TRUE, | ||
test_translate_sql(difftime(start_date, end_date, tz = "UTC", units = "days")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expectg_error(class = "unsupported_arg_error"
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woops, should have called this out in a self-review—these two lines transition from expect_error()
to expect_snapshot()
for one-off, unclassed errors where we're interested in testing the message specifically.
Related to the first checkbox in #1546 but does not close; a demo of what that PR would look like for all backends.
For snowflake, transition
expect_error()
:expect_no_error()
(or no test) whenregex = NA
expect_warning()
andexpect_message()
.