test-set.Rd
This function attaches unit tests in value
to an object (typically a
function) as an attribute "test"
.
test(f) <- value
f | the function (object) to which the tests are to be attached |
---|---|
value | the test code, a function with no parameters |
f
with the test attached as attribute "test"
f <- function(x) x^2 test(f) <- function() { context("f") test_that("correct result for complex number", { expect_equal(f(1i), -1 + 0i) }) }