The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
testex
test examples Add tests and assertions in-line in examples
Set up your package to use testex
using
and then start adding tests!
#' Hello, World!
#'
#' @examples
#' hello("World")
#' @test "Hello, World!"
#'
#' hello("darkness my old friend")
#' @test grepl("darkness", .)
#'
#' @export
hello <- function(who) {
paste0("Hello, ", who, "!")
}
If you were already using testthat
, you’ll immediately see a new test context for testing your examples. And if you aren’t using testthat
, then you’ll find that your tests are being run with your examples when you run R CMD check
roxygen2
tags@test
will check that the result of the last example is identical to your test. You can use the example output in a function using a .
.
@testthat
is similar, but has the added benefit of automatically inserting a .
into testthat::expect_*
functions.
roxytest
A slightly different approach. Allows tests to be written in-line, but generates test files used directly by a testing framework.These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.