https://github.com/cran/fOptions
Raw File
Tip revision: 09a16d4365605c86100bf01684a3304933dfbdd8 authored by Yohan Chalabi on 23 June 2013, 00:00:00 UTC
version 3010.83
Tip revision: 09a16d4
doRUnit.R
#### doRUnit.R --- Run RUnit tests
####------------------------------------------------------------------------

### Origianlly 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)) {

  ## --- Setup ---

  wd <- getwd()
  pkg <- sub("\\.Rcheck$", '', basename(dirname(wd)))

  library(package=pkg, character.only = TRUE)

  path <- system.file("unitTests", package = pkg)

  stopifnot(file.exists(path), file.info(path.expand(path))$isdir)

  source(file.path(path, "runTests.R"), echo = TRUE)
}
back to top