Skip to contents

expect_rules_covered() is one testthat expectation. It fails when a rule of the registry rules has no record of expect_rule_red() or no record of expect_rule_green() in this R session. The failure message names each of these rules.

Usage

expect_rules_covered(rules)

Arguments

rules

The registry: a named list of rule() entries.

Value

The names of the rules, invisibly.

Details

Call it in the test file whose name sorts last, such as test-zzz_rule_coverage.R. testthat runs the test files in the order of their names, in one R session, so that file sees the records of all the others.

See also

Other test helpers: expect_rule_red()

Examples

# In tests/testthat/test-zzz_rule_coverage.R of a package:
# test_that("each rule has a red and a green test", {
#   checkit::expect_rules_covered(my_rules())
# })