diff --git a/DESCRIPTION b/DESCRIPTION index 87b973c790..d20d9c112b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -121,6 +121,7 @@ Collate: 'utils-format.r' 'utils-replace-with.R' 'utils.r' + 'vapply.R' 'view.r' 'zzz.r' RoxygenNote: 5.0.1 diff --git a/R/vapply.R b/R/vapply.R new file mode 100644 index 0000000000..e68770ffb5 --- /dev/null +++ b/R/vapply.R @@ -0,0 +1,3 @@ +vcapply <- function(X, FUN, ..., USE.NAMES = TRUE) { + vapply(X = X, FUN = FUN, FUN.VALUE = character(1L), ..., USE.NAMES = USE.NAMES) +} \ No newline at end of file diff --git a/tests/testthat/helper-astyle.R b/tests/testthat/helper-astyle.R index 099eb32c80..a22184c88a 100644 --- a/tests/testthat/helper-astyle.R +++ b/tests/testthat/helper-astyle.R @@ -16,8 +16,9 @@ astyle <- function(extra_args = character()) { "--align-reference=type" ) - src_path <- normalizePath(testthat::test_path("../../src")) - astyle_files <- file.path(src_path, setdiff(dir(src_path, "[.]cpp$"), "RcppExports.cpp")) + src_path <- normalizePath(vcapply(c("../../src", "../../inst/include"), testthat::test_path)) + src_files <- dir(src_path, "[.](?:cpp|h)$", recursive = TRUE, full.names = TRUE) + astyle_files <- grep("(?:RcppExports[.]cpp|static_assert[.]h)", src_files, value = TRUE, invert = TRUE) output <- system2(astyle_cmd, c(astyle_args, astyle_files, extra_args), stdout = TRUE, stderr = TRUE) unchanged <- grepl("^Unchanged", output) if (any(!unchanged)) {