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

Use custom triple-quote syntax for diffing string literals #212

Merged
merged 1 commit into from
Jun 10, 2020

Conversation

dsnet
Copy link
Collaborator

@dsnet dsnet commented Jun 10, 2020

Using strings.Join to denote differences in a multi-line string is
visually noisy due to extensive use of quotes and escape sequences.
Add a custom triple-quote syntax that unambiguously shows line
differences with less visual noise.

If the triple-quote syntax cannot unmabiguously show differences,
then the reporter falls back on using the strings.Join format,
which is never ambiguous.

Fixes #195

@dsnet dsnet force-pushed the string-literal branch 2 times, most recently from 6efaabd to b241216 Compare June 10, 2020 19:02
Using strings.Join to denote differences in a multi-line string is
visually noisy due to extensive use of quotes and escape sequences.
Add a custom triple-quote syntax that unambiguously shows line
differences with less visual noise.

If the triple-quote syntax cannot unmabiguously show differences,
then the reporter falls back on using the strings.Join format,
which is never ambiguous.

Fixes #195
@dsnet dsnet merged commit 0cd6169 into master Jun 10, 2020
@karlkfi
Copy link

karlkfi commented Jun 10, 2020

Thanks! Looks great!

@dsnet
Copy link
Collaborator Author

dsnet commented Jun 10, 2020

This is all based on heuristics. If you find that it could use some tweaking, file another issue.

Actually, the reporter itself is a complicated set of heuristics, feedback is welcome for making it better.

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

Successfully merging this pull request may close these issues.

Simplified reporting for string Diff?
3 participants