This package provides some addons for testthat used by hyperSpec and hySpc.*.
Online documentation is available via pkgdown.
hySpc.testthat allows to attach unit tests to functions:
f <- function(x) 2*x
test(f) <- function(){
context("testing f")
test_that("foo", expect (bar))
}
to keep test code and functional code close to each other.
Functions test_fun()
and unittest()
execute unit tests that are thus attached to functions.
See tests/testthat/test_attached.R for including these tests into the usual test suit executed by devtools::test()
.