-
-
Notifications
You must be signed in to change notification settings - Fork 218
Expand file tree
/
Copy pathdoRUnit.R
More file actions
33 lines (22 loc) · 1.24 KB
/
doRUnit.R
File metadata and controls
33 lines (22 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#### doRUnit.R --- Run RUnit tests
####------------------------------------------------------------------------
### borrowed from package fUtilities in RMetrics
### http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/pkg/fUtilities/tests/doRUnit.R?rev=1958&root=rmetrics&view=markup
### Originally follows Gregor Gojanc's example in CRAN package 'gdata'
### and the corresponding section in the R Wiki:
### http://wiki.r-project.org/rwiki/doku.php?id=developers:runit
### MM: Vastly changed: This should also be "runnable" for *installed*
## package which has no ./tests/
## ----> put the bulk of the code e.g. in ../inst/unitTests/runTests.R :
if(require("RUnit", quietly = TRUE)) {
pkg <- "Rcpp"
require( pkg, character.only=TRUE)
path <- system.file("unitTests", package = pkg)
stopifnot(file.exists(path), file.info(path.expand(path))$isdir)
# without this, we get unit test failures
Sys.setenv( R_TESTS = "" )
Rcpp.unit.test.output.dir <- getwd()
source(file.path(path, "runTests.R"), echo = TRUE)
} else {
print( "package RUnit not available, cannot run unit tests" )
}