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

Error when diffing list containing empty list #88

Closed
wch opened this issue Nov 10, 2016 · 2 comments
Closed

Error when diffing list containing empty list #88

wch opened this issue Nov 10, 2016 · 2 comments

Comments

@wch
Copy link

wch commented Nov 10, 2016

It's not clear to me whether diffObj is meant to be used for complex structures like nested lists, but it seems that at it at least shouldn't give an error (or that the error is more informative). Example:

> diffObj(list(list()), list(list()))
Error in trim_sub(obj.as.chr, stripped) : 
  Logic Error: trimmed string is not a substring of orginal, contact maintainer
Error in apply_trim(target, tar.capt.p, etc@trim) : 
  `*trim` method produced an error when attempting to trim ; If you did not define custom `*trim` methods contact maintainer (see `?trim`).
@brodieG
Copy link
Owner

brodieG commented Nov 10, 2016

This is definitely a bug. It is supposed to work well with nested structures, but obviously I didn't properly handle the case you bring up. I'll fix this in the next release (and hopefully get development branch fixed today). In the meantime, you can use:

diffStr(list(list()), list(list()))

or

diffObj(list(list()), list(list()), trim=FALSE)

to work around the issue. Thanks for reporting.

@brodieG brodieG added the bug label Nov 10, 2016
@brodieG brodieG added this to the 0.1.6 milestone Nov 10, 2016
@brodieG
Copy link
Owner

brodieG commented Nov 11, 2016

This should now be working in install_github('brodieg/diffobj@development'). Unfortunately I seem to have introduced some minor regressions for R 3.4.x in the process, but I don't have time to look at those now. The R release tests all pass. I am hoping to get version 0.1.6 with these fixes and others out to CRAN in the next week or two.

Let me know if for whatever reason this does not work for you.

Also, feel free to add feature request issues if you have use cases for diffobj that don't appear currently covered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants