The inventory lists owned test files in tests/testthat and
longtests/testthat. It includes @tests and @testexamples files from
roxytest that biocroxytest can adopt.
Manual tests, helpers and snapshots are excluded.
Value
generated_test_inventory() returns a data frame with suite,
source, and path columns. Paths are relative to the package root.
check_generated_tests() returns TRUE invisibly if output is current.
Otherwise it signals a biocroxytest_stale_tests error with a changes
data frame. Its status column is missing, changed, or obsolete,
followed by the inventory columns.
Details
The check regenerates tests in a temporary copy using the package's
roxygen configuration and a fresh R session. It checks both suites for
tests_roclet() or only the long suite for longtests_roclet(). Install
the package's development dependencies before running the check. The
checkout is left in place. The copy includes package inputs and the two
test suites. See vignette("named-cases") for the input roots and how to
declare additional files with Config/biocroxytest/inputs. Retained paths
must be ordinary files and directories. Roxygen loads package code, so
check packages whose code you trust. LF and CRLF are equivalent in
generated files.
Examples
pkg <- tempfile("generated-test-example-")
dir.create(file.path(pkg, "tests", "testthat"), recursive = TRUE)
writeLines("Package: examplepkg", file.path(pkg, "DESCRIPTION"))
writeLines(
"# Generated by biocroxytest: do not edit by hand!",
file.path(pkg, "tests", "testthat", "test-roxytest-tests-example.R")
)
generated_test_inventory(pkg)
#> suite source path
#> 1 tests R/example.R tests/testthat/test-roxytest-tests-example.R
unlink(pkg, recursive = TRUE)
