Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More default options for filter #6

Closed
lentinj opened this issue Jun 23, 2022 · 0 comments
Closed

More default options for filter #6

lentinj opened this issue Jun 23, 2022 · 0 comments

Comments

@lentinj
Copy link
Contributor

lentinj commented Jun 23, 2022

The filter options flip through a string representation of an object until it finds one that doesn't match:

unittest/R/ut_cmp.R

Lines 20 to 31 in cf19036

for (f in list(
# Add any custom filtering function
filter,
# Strings can be compared directly using writeLines
ifelse(is.character(a) && is.character(b), writeLines, 'ignore'),
# Convert environments to list, print that
ifelse(is.environment(a) && is.environment(b), function (x) print(as.list(x)), 'ignore'),
# print will pick up any generics defined for custom types
print,
# Fall back to parsing with str
function (x) utils::str(x, vec.len = 1000, digits.d = 5, nchar.max = 1000),
NULL)) {

The theory was it should end with multiple str calls, increasing length / accuracy until it generates output that is different. Something like:-

    function (x) utils::str(x, vec.len = 1000, digits.d = 5, nchar.max =
1000),
   function (x) utils::str(x, vec.len = 1e10, digits.d = 10, nchar.max =
1e10),
   function (x) utils::str(x, vec.len = 1e20, digits.d =
.Machine$double.digits, nchar.max = 1e20),
lentinj added a commit that referenced this issue Aug 21, 2022
Increase str() detail until a difference is found.
@lentinj lentinj closed this as completed Aug 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant