diff --git a/.travis.yml b/.travis.yml index c144a16..41d3501 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/DESCRIPTION b/DESCRIPTION index 05c6a42..1eeca2e 100644 --- a/DESCRIPTION +++ b/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 diff --git a/NEWS.md b/NEWS.md index 1cd33b1..f94cabd 100644 --- a/NEWS.md +++ b/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. diff --git a/R/knitr-shellwords.R b/R/knitr-shellwords.R index 2a0cf5d..da4257c 100644 --- a/R/knitr-shellwords.R +++ b/R/knitr-shellwords.R @@ -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] != "") { diff --git a/tests/testthat/test-90-regression.R b/tests/testthat/test-90-regression.R new file mode 100644 index 0000000..da5ee55 --- /dev/null +++ b/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)) +})