# example code
1 + 2
# within `testex` block, test code refers to previous result with `.`
testex(style = "testthat", srcref = "abc.R:1:3", { # \dontshow{
. <- 3 # needed because roxygen2 @examplesIf mutates .Last.value
# }
test_that("addition holds up", {
expect_equal(., 3)
})
})
Run the code above in your browser using DataLab