Skip to content

Commit

Permalink
Use as.character(user_code) in check_blanks() to avoid issue with…
Browse files Browse the repository at this point in the history
… unserialized user code in R < 3.5
  • Loading branch information
rossellhayes committed Jul 6, 2021
1 parent 5f5f0fb commit 4c023ec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/exercise.R
Original file line number Diff line number Diff line change
Expand Up @@ -688,9 +688,11 @@ exercise_code_chunks <- function(chunks) {
}

check_blanks <- function(user_code, blank_regex) {
# Ensure `user_code` is a character vector to avoid issue with unserialized
# code which comes as a list in R < 3.5
user_code <- as.character(user_code)
blank_regex <- paste(blank_regex, collapse = "|")

blanks <- str_match_all(user_code, blank_regex)
blanks <- str_match_all(user_code, blank_regex)

if (!length(blanks)) {
return(NULL)
Expand Down

0 comments on commit 4c023ec

Please sign in to comment.