convert_test

0th

Percentile

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

convert_package_tests, convert_test_file

Aliases
  • convert_test
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)
Documentation reproduced from package runittotestthat, version 0.0-2, License: Unlimited

Community examples

Looks like there are no examples yet.