-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
seems quite easy with python's pook (mock.calls), see first example block at https://github.com/h2non/pook?tab=readme-ov-file#examples
in this package, perhaps something like
# use a function so user doesn't have to figure out the
# incantation for the R6 object
call_count <- function(stub) {
stub$counter$count()
}
# possibly use the last stub used by default? but would have to show
# the stub then (`last_stub_used` doesn't exist yet)
call_count <- function(stub = last_stub_used()) {
stub$counter$count()
}
# optionally just give back counts for all stubs if `stub` is `NULL`?
# this uses cli so would have to add that dep, but it doesn't have deps itself
call_count <- function(stub = NULL) {
reg <- stub_registry()
stubs <- reg$request_stubs
cli_alert_info(style_underline(style_bold("count --- stub")))
for (stub in stubs) {
cat(
symbol$info, " ",
style_bold(stub$counter$count()), " --- ",
stub$to_s(), "\n",
sep = ""
)
}
}Metadata
Metadata
Assignees
Labels
No labels