Skip to content

Commit

Permalink
Merge c4cd0c4 into 688cfe1
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwiroy committed Jul 5, 2019
2 parents 688cfe1 + c4cd0c4 commit 05aa5ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/knitr-shellwords.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ shellwords <- function(x) {
)
)"
xo <- str_match_all(string = x, pattern = shellwords_re)

if (length(xo) == 0) {
return(character(0))
}
for (i in seq_along(xo[[1]][,1])) {
xo[[1]][i,7] <- NA
if(!is.na(xo[[1]][i,6]) && xo[[1]][i,6] != "") {
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test-90-regression.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
context("regression tests")

test_that("regression - handle NULL from knitr::opts_chunk$get('engine.opts')$perl ", {
words <- perlbrewr:::shellwords(x = NULL)
expect_equal(words, character(0))
})

0 comments on commit 05aa5ed

Please sign in to comment.