testex-testthat | R Documentation |
testthat
Expectationstestthat
support is managed through a "style" provided to testex
.
When using the testthat
style (automatically when using the @testthat
tag), expectations are processed such that they always refer to the previous
example. Special care is taken to manage propagation of this value through
your test code, regardless of how testthat
is executed.
# example code
1 + 2
# within `testex` block, test code refers to previous result with `.`
testex(style = "testthat", srcref = "abc.R:1:3", {
test_that("addition holds up", {
expect_equal(., 3)
})
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.