Created
August 28, 2014 04:20
-
-
Save 3100/e71ed271c728739d9c89 to your computer and use it in GitHub Desktop.
run test of R code for dir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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