Skip to content

Commit

Permalink
also prettify header files in inst
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Aug 31, 2016
1 parent 27422d9 commit 6c4b09b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ Collate:
'utils-format.r'
'utils-replace-with.R'
'utils.r'
'vapply.R'
'view.r'
'zzz.r'
RoxygenNote: 5.0.1
3 changes: 3 additions & 0 deletions R/vapply.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vcapply <- function(X, FUN, ..., USE.NAMES = TRUE) {
vapply(X = X, FUN = FUN, FUN.VALUE = character(1L), ..., USE.NAMES = USE.NAMES)
}
5 changes: 3 additions & 2 deletions tests/testthat/helper-astyle.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 6c4b09b

Please sign in to comment.