new_test: Generate 'testthat' Style Test .R Files

Description Usage Arguments Value References See Also Examples

View source: R/new_test.R

Description

Quickly produce a testthat style test ‘.R’ template file from a function (output file will include the function) or a character string.

Usage

1
new_test(fun, path = "tests/testthat", file.name = NULL)

Arguments

fun

A function or character string naming the function.

path

Path to directory to generate the function test in. Default is to use "tests/testthat" for ease of use within RStudio.

file.name

By default the file is named the same as:
"text-" + fun + ".R".
This can be changed by supplying a file name to file.name.

Value

Generates a ‘test-____.R’ file.

References

http://r-pkgs.had.co.nz/tests.html

See Also

Other new functions: new_data, new_r_test, new_r, new_vignette

Examples

1
2
3
4
dir.create("temp_dir")
new_test(paste, "temp_dir")
new_test("myfun", "temp_dir")
unlink("temp_dir", TRUE, TRUE)

trinker/pax documentation built on March 21, 2018, 3:01 a.m.