Build TEST edges from test files to user-defined functions
Source:R/edge_builders.R
build_test_edges.RdParses each test file for references to user-defined function names, using
the same AST-walking approach used in find_calls_in_body(). A TEST
edge (test_file_stem -> function_node_id) is emitted when a test file
calls a function that exists as a node in func_nodes.
Arguments
- func_nodes
A list of function node records from
extract_function_nodes().- test_files
Character vector of absolute paths to test
.Rfiles.
Value
A data.frame with columns:
fromTest file stem, character.
tonode_idof the tested function, character.weightNumeric: edge weight (default
1).
Details
Test-helper symbols (expect_*, test_that, describe, it, setup,
teardown, skip*, withr::*) are excluded from matching to avoid false
edges to non-existent nodes.
Examples
if (FALSE) { # \dontrun{
proj <- detect_rproject("/path/to/mypkg")
nodes <- extract_function_nodes(proj$r_files)
edges <- build_test_edges(nodes, proj$test_files)
} # }