You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current approach of using NA to test that a condition should not be observed is slightly confusing (at least for me) because it doesn't clearly convey the intent. For example, using expect_error(..., NA) to test that you don't expect an error.
But I am possibly not alone in thinking this way. A cursory search restricted only to GitHub reveals that many developers seem to be using custom negative variants (expect_no_error(), expect_no_warning(), expect_no_message()) to test that the code does not throw errors, warnings, or messages.
So, it will be nice if {testthat} natively supported these functions as an additional way to test for absence of errors, warnings, and messages.
Happy to make a PR if you think this is worth supporting.
I think using NA as a sentinel for missing, i.e. expect that errors are missing is already adequate and don't currently have plans to add these specific negations.
The current approach of using
NA
to test that a condition should not be observed is slightly confusing (at least for me) because it doesn't clearly convey the intent. For example, usingexpect_error
(..., NA)
to test that you don't expect an error.But I am possibly not alone in thinking this way. A cursory search restricted only to GitHub reveals that many developers seem to be using custom negative variants (
expect_no_error()
,expect_no_warning()
,expect_no_message()
) to test that the code does not throw errors, warnings, or messages.So, it will be nice if
{testthat}
natively supported these functions as an additional way to test for absence of errors, warnings, and messages.Happy to make a PR if you think this is worth supporting.
The text was updated successfully, but these errors were encountered: