testex-testthat {testex}R Documentation

Support for testthat Expectations

Description

testthat 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.

Examples


# 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)
  })
})


[Package testex version 0.2.0 Index]