convert_test
From runittotestthat v0.0-2
by Richard Cotton
Convert an RUnit test to a testthat test
Converts a single RUnit test to a testthat test.
Usage
convert_test(runit_test_fn, test_description = assertive::get_name_in_parent(runit_test_fn))
Arguments
- runit_test_fn
- An
RUnit
test function. - test_description
- A string describing the test, defaulting to
the name of the
RUnit
test function.
Value
-
A call to
test_that
, containing a testhat
test
equivalent to the input RUnit
test.
See Also
Examples
test_truth <- function()
{
x <- all(runif(10) > 0)
checkTrue(x)
}
convert_test(test_truth)
test_equality <- function()
{
x <- sqrt(1:5)
expected <- c(1, 4, 9, 16, 25)
checkEquals(expected, x ^ 4)
}
convert_test(test_equality)
test_error <- function()
{
checkException("1" + "2")
}
convert_test(test_error)
Community examples
Looks like there are no examples yet.