Skip to content

Commit 65307c8

Browse files
committed
Remove documented-but-unimplemented include = "callers" option
The roxygen for pv_to_json() and pv_to_list() advertised "callers" as an include option, but it was absent from both the default vector and the function body, so following the docs errored in match.arg(). It cannot be implemented as-is: pv_callers() requires a function name, and a whole-profile export has none to supply. Removed from the docs instead, with a test asserting the documented set matches what is actually accepted.
1 parent 10e9c88 commit 65307c8

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

R/export.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#' @param pretty If `TRUE`, formats JSON with indentation for readability.
1010
#' @param include Character vector specifying which analyses to include.
1111
#' Options: "summary", "self_time", "total_time", "hot_lines", "memory",
12-
#' "callers", "gc_pressure", "suggestions", "recursive". Default includes all.
12+
#' "gc_pressure", "suggestions", "recursive". Default includes all.
1313
#' @param system_info If `TRUE`, includes R version and platform info in
1414
#' metadata. Useful for reproducibility.
1515
#'

man/pv_to_json.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-export.R

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,31 @@ test_that("pv_to_json respects include parameter", {
3434
expect_false(grepl("\"total_time\":", json_limited))
3535
})
3636

37+
test_that("every documented include option is accepted", {
38+
p <- pv_example()
39+
opts <- eval(formals(pv_to_json)$include)
40+
41+
expect_equal(
42+
opts,
43+
c(
44+
"summary",
45+
"self_time",
46+
"total_time",
47+
"hot_lines",
48+
"memory",
49+
"gc_pressure",
50+
"suggestions",
51+
"recursive"
52+
)
53+
)
54+
expect_equal(eval(formals(pv_to_list)$include), opts)
55+
56+
for (opt in opts) {
57+
expect_no_error(pv_to_json(p, include = opt))
58+
expect_no_error(pv_to_list(p, include = opt))
59+
}
60+
})
61+
3762
test_that("pv_to_json pretty parameter works", {
3863
p <- pv_example()
3964

0 commit comments

Comments
 (0)