File: doRUnit.R

package info (click to toggle)
fbasics 3042.89-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,628 kB
  • sloc: ansic: 718; makefile: 14
file content (26 lines) | stat: -rw-r--r-- 841 bytes parent folder | download | duplicates (8)
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
#### 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)
}