Skip to content

Instantly share code, notes, and snippets.

@3100
Created August 28, 2014 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3100/e71ed271c728739d9c89 to your computer and use it in GitHub Desktop.
Save 3100/e71ed271c728739d9c89 to your computer and use it in GitHub Desktop.
run test of R code for dir
library(testthat)
(function(){
dir <- dirname(sys.frame(1)$ofile)
Test <- function(src.name) {
message(src.name)
source(paste(dir, '/', src.name, sep = ''))
test_file(paste(dir, '/test_', src.name, sep = ''))
}
# HACK
src.names <- grep('^(?!test|run_test).+$',
list.files(pattern = '^.+\\.R$', path = dir, include.dirs = F),
perl = T, value = T)
sapply(src.names, Test)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment