testInline: Write tests in your source

Description Usage Arguments

Description

This functions can be used in package development to keep your unit tests where your function definitions are. The code in expr will be saved into a R file in the test directory. And can then be called by your testing framework. Files will be created and replaced on the fly.

Usage

1
2
3
4
testInline(label, expr, file = paste0("test-", label, ".R"),
  dir = getOption("testInline.directory", "tests/testthat"),
  eval = interactive(), testFun = getOption("testInline.testFun", function()
  devtools::test(filter = label)))

Arguments

label

label for tests. Used only as default in other arguments

expr

test code

file

character with name of file in which expr will be stored

dir

directory where you want your tests

eval

if you want to evaluate your testcode right away

testFun

how you test code is evaluated. Only relevant if called interactively


wahani/testInline documentation built on May 3, 2019, 8:09 p.m.