Skip to content

Commit

Permalink
Merge commit 'e17fa1255635d85494beef3716fc5593948555dd'
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Oct 22, 2024
2 parents cd1f38d + e17fa12 commit 24b93e9
Show file tree
Hide file tree
Showing 5 changed files with 935 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Imports:
diffobj (>= 0.3.4),
glue,
methods,
rlang (>= 1.0.0)
rlang (>= 1.1.0)
Suggests:
bit64,
R6,
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# waldo (development version)

* `compare()` can numeric differences between int64 objects and integers/doubles when `tolerance` is set (#159).
* `compare()` now gives informative errors if you misspecify the argument types (#181)
* waldo gains basic support for S7 objects (#200).
* `as_map()` now preserves attributes (#185).
* `compare()` can now distinguish between objects that differ only in the value of their S4 bit (#189).
Expand Down
16 changes: 15 additions & 1 deletion R/compare.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
#' this is R's default behaviour. Use `FALSE` when specifically concerned
#' with the encoding, not just the value of the string.
#' @param list_as_map Compare lists as if they are mappings between names and
#' values. Concretely, this drops `NULLs` in both objects and sorts named
#' values. Concretely, this drops `NULL`s in both objects and sorts named
#' components.
#' @param quote_strings Should strings be surrounded by quotes? If `FALSE`,
#' only side-by-side and line-by-line comparisons will be used, and there's
Expand Down Expand Up @@ -137,6 +137,20 @@ compare <- function(x, y, ...,
quote_strings = TRUE
) {

check_string(x_arg)
check_string(y_arg)
check_number_decimal(tolerance, allow_null = TRUE, min = 0)
check_number_whole(max_diffs, min = 1, allow_infinite = TRUE)
check_bool(ignore_srcref)
if (!isTRUE(ignore_attr) && !is.character(ignore_attr)) {
stop_input_type(ignore_attr, "a TRUE or a character vector")
}
check_bool(ignore_encoding)
check_bool(ignore_function_env)
check_bool(ignore_formula_env)
check_bool(list_as_map)
check_bool(quote_strings)

opts <- compare_opts(
...,
tolerance = tolerance,
Expand Down
Loading

0 comments on commit 24b93e9

Please sign in to comment.