test_fun: Run test attached to function

Description Usage Arguments Value Examples

View source: R/test-fun.R

Description

Execute test attached to a function with testthat::Reporter.

Usage

1
test_fun(object, reporter = "minimal")

Arguments

object

to which the test is attached

reporter

testthat::Reporter to use

Value

the test (function)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
f <- function(x) x^2

test(f) <- function() {
   context("f")

   test_that("correct result for complex number", {
     expect_equal(f(1i), -1 + 0i)
   })
}

test_fun(f)

hySpc.testthat documentation built on July 2, 2020, 2:31 a.m.