View source: R/run_covr_skip_nstf.R
| prepare_tinytest_dev_includes | R Documentation |
Some tinytest files compile inline C/C++ during the run (e.g. via
Rcpp::sourceCpp()). When coverage loads the package from its source
tree with pkgload::load_all(), public headers live under
inst/include/, but the compiler flags emitted by self-compilation
helpers typically reference the installed layout (include/).
Packages that ship headers in inst/include (e.g. Rcpp) therefore
fail with ‘Rcpp.h: No such file or directory’ unless the source-tree
include directory is prepended to the preprocessor flags.
prepare_tinytest_dev_includes(pkg_source_path, tiny_dir)
pkg_source_path |
Character scalar. Path to the package source root. |
tiny_dir |
Character scalar. Path to the tinytest directory
(typically |
This helper detects inst/include/ under pkg_source_path, optionally
adds <tiny_dir>/cpp/ when present, and prepends corresponding -I
flags to PKG_CPPFLAGS and CLINK_CPPFLAGS. Packages without
inst/include/ (e.g. digest) are unchanged.
The function is intentionally defensive and never throws: on any problem it
returns a no-op result so the surrounding tinytest coverage path is
unaffected. Callers should register the returned teardown via
on.exit() to restore the previous environment state.
A list with components:
Character vector of absolute include directories that were added; empty when no dev-tree headers are present.
A function that restores the previous PKG_CPPFLAGS
and CLINK_CPPFLAGS values (unsetting variables that were
previously unset).
Other nstf_utility:
check_covr_skip_testit(),
create_base_tests_coverage(),
create_nstf_covr_list(),
create_tinytest_coverage(),
get_nstf_test_path(),
get_source_test_mapping_nstf(),
prepare_tinytest_run_env(),
restrict_test_paths_to_framework(),
run_covr_skip_nstf()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.