Created
November 28, 2024 16:09
-
-
Save jakubsob/f96f4cef31d83c692c067b7deef9d62f to your computer and use it in GitHub Desktop.
Report all {checkmate} assertions in the style of {withr}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #' Report all assertions | |
| #' | |
| #' @examples | |
| #' with_assertion_collection( | |
| #' assert_data_frame(df), | |
| #' assert_numeric(nums), | |
| #' assert_character(chars) | |
| #' ) | |
| with_assert_collection <- function(...) { | |
| add <- makeAssertCollection() | |
| quos <- enquos(...) | |
| quos <- map(quos, call_modify, add = add) | |
| walk(quos, eval_tidy) | |
| reportAssertions(add) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment