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

Switching between character/line diff? #127

Closed
mindplay-dk opened this issue Dec 15, 2021 · 1 comment
Closed

Switching between character/line diff? #127

mindplay-dk opened this issue Dec 15, 2021 · 1 comment
Labels
enhancement reporters anything related to the "reporters" sub package

Comments

@mindplay-dk
Copy link
Contributor

In the diff reporter, can we have some means of switching between diffChars and diffLines?

diffChars works well for individual strings, but doesn't work so well for multi-line content.

(This is also (presumably) why diffJson internally uses the lineDiff tokenizer.)

The simplest option, I think, would be to have diffStrings check for line-breaks in expected - if line-breaks are present, use diffLines instead of diffChars, which would give an output more similar to that of diffObjects.

Perhaps better, if expected contains line-breaks, to do both a line diff and a character diff, and see which one yields the fewest results - and then render that as the result.

For me, personally, the simplest option would work: just treat multi-line strings as lines.

@lorenzofox3
Copy link
Owner

That sounds like a good idea

@lorenzofox3 lorenzofox3 added reporters anything related to the "reporters" sub package enhancement labels Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement reporters anything related to the "reporters" sub package
Projects
None yet
Development

No branches or pull requests

2 participants