How to test a function that handles error objects and sys calls?

I'm having trouble achieving 100% coverage on my new package.
sentryR has functions to capture errors and report them to the sentry server, but I'm not sure how to test functions that expect error objects or sys.calls().

An example is:

capture_function_calls <- function(error) {
  error$function_calls <- sys.calls()
  signalCondition(error)
}

more here:

Any tips and direction is greatly appreciated :slight_smile:

1 Like

Maybe mocking could help? Mocking is catching - R-hub blog

It's a very vague answer, but you said any direction would be appreciated. :wink:

2 Likes

This is an option yes if there's no other way :slight_smile:
thanks for the link

1 Like