convert_test: Convert an RUnit test to a testthat test

Description Usage Arguments Value See Also Examples

View source: R/convert.R

Description

Converts a single RUnit test to a testthat test.

Usage

1
2
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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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)

runittotestthat documentation built on May 2, 2019, 9:36 a.m.