convert_package_tests: Convert a package worth of RUnit tests to testthat tests

Description Usage Arguments Value Note See Also

View source: R/convert.R

Description

Converts all RUnit tests in a package to testthat tests, and writes them out to a file.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
convert_package_tests(pkg, test_dir = "inst/tests",
  test_file_regexp = "^runit.+\\.[rR]", test_func_regexp = "^test.+",
  testthat_files = stdout(), ...)

## S3 method for class 'package'
convert_package_tests(pkg, test_dir = "inst/tests",
  test_file_regexp = "^runit.+\\.[rR]", test_func_regexp = "^test.+",
  testthat_files = stdout(), ...)

## S3 method for class 'character'
convert_package_tests(pkg, test_dir = "inst/tests",
  test_file_regexp = "^runit.+\\.[rR]", test_func_regexp = "^test.+",
  testthat_files = stdout(), ...)

Arguments

pkg

Either a string containing a path to a package or a devtools::package object.

test_dir

Directory inside the package containing test files.

test_file_regexp

Regular expression determining which files are considered to contain tests.

test_func_regexp

Regular expression determining which functions in the tests files are considered to be tests.

testthat_files

Character vector of paths for the output files. Defaults to stdout() to prevent you overwriting your existing test files. Use runit_files to refer to the original RUnit test files.

...

Not currently used.

Value

A list of lists of calls. Each call element is a testthat test. The names of the top level list correspond to the names of the input test files. The names of the sublists correspond to the names of the RUnit test functions in that file. Each list element has an environment containing the original RUnit, stored in attr(, "runit_tests").

Note

RUnit tests will be evaluated when they are read in, so make sure that all your tests pass before you convert them.

See Also

convert_test_file, convert_test


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