Skip to content

Commit

Permalink
Merge pull request #3 from kiwiroy/subscript-oob-error
Browse files Browse the repository at this point in the history
Subscript out of bounds error
  • Loading branch information
kiwiroy committed Jul 5, 2019
2 parents 688cfe1 + fff9771 commit a6cdef5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Expand Up @@ -30,9 +30,9 @@ after_success:
- test $TRAVIS_R_VERSION_STRING = "release" && Rscript -e 'Sys.setenv("R_COVR_SRCDIR"=here::here()); covr::coveralls()'

before_deploy:
# - which perlbrew
# - which cpanm
# - perlbrew list
- which perlbrew
- which cpanm
- perlbrew list
- Rscript -e 'withr::with_temp_libpaths(action = "prefix", code = { devtools::install(pkg = ".", reload = FALSE); pkgdown::build_site(pkg = "."); })'
- touch gh-pages/.nojekyll

Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
@@ -1,6 +1,6 @@
Package: perlbrewr
Title: Integrates Perlbrew With R, Specifically (knitr & rmarkdown)
Version: 0.0.0.9000
Version: 0.0.1.9000
Authors@R: c(
person("Roy", "Storey", email = "kiwiroy@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-1375-7136")))
Description: The goal of perlbrewr is to assist the loading of a perlbrew
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
@@ -1,3 +1,7 @@
# perlbrewr 0.0.1.9000

* Resolved subscript out of bound error (#3)

# perlbrewr 0.0.0.9000

* Added a `NEWS.md` file to track changes to the package.
Expand Down
4 changes: 3 additions & 1 deletion R/knitr-shellwords.R
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
@@ -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 a6cdef5

Please sign in to comment.