swh:1:snp:cae2596088bc8b92147ee77a766423472ecb4710
Raw File
Tip revision: c1832b6bdcd20c6f08fd6c0e65898e660d1de1ce authored by Dirk Eddelbuettel and Romain Francois on 08 June 2010, 13:19:29 UTC
version 0.8.1
Tip revision: c1832b6
doRUnit.R
#### 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" )
}                                                                                                 
back to top