-
Notifications
You must be signed in to change notification settings - Fork 186
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
small simplification for glue, add coverage test #1660
Conversation
@@ -165,8 +165,7 @@ extract_glued_symbols <- function(expr) { | |||
parse(text = xml2::xml_text(cl)), | |||
error = function(...) NULL, | |||
warning = function(...) NULL | |||
)[[1L]] | |||
if (is.null(parsed_cl)) next |
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.
I can't think of how we could end up with a parsing error here... if there's a flaw in our thinking that might lead to that happening, we should let it cause an error & users can report it so we can tighten the logic elsewhere.
@@ -160,13 +160,16 @@ extract_glued_symbols <- function(expr) { | |||
} | |||
glued_symbols <- new.env(parent = emptyenv()) | |||
|
|||
unexpected_error <- function(cond) { | |||
stop("Unexpected failure to parse glue call, please report: ", conditionMessage(cond)) |
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.
Can we add a test to make sure that we get this expected error message?
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.
no -- I don't know how to trigger the error. it should be nocov but covr doesn't separate out tryCatch branches
length(parsed_text) == 0
also covers the case likeglue("{}")
where an empty expression is parsed (parsed_text
isexpression()
). I don't see hownrow(parse_data) == 0
is possible after that (even a comment generates parse data).