test-set.RdThis function attaches unit tests in value to an object (typically a
function) as an attribute "test".
test(f) <- valuethe function (object) to which the tests are to be attached
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)
})
}