TestSuite: multi-line string diff support - #38
Merged
Conversation
mosra
force-pushed
the
testsuite-file-diff
branch
2 times, most recently
from
February 20, 2023 20:14
74207f6 to
170a0cb
Compare
Codecov ReportBase: 98.04% // Head: 98.05% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #38 +/- ##
==========================================
+ Coverage 98.04% 98.05% +0.01%
==========================================
Files 138 139 +1
Lines 11577 11639 +62
==========================================
+ Hits 11351 11413 +62
Misses 226 226
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
mosra
force-pushed
the
testsuite-file-diff
branch
2 times, most recently
from
February 21, 2023 00:21
05dfcb1 to
aa37c2e
Compare
mosra
force-pushed
the
testsuite-file-diff
branch
from
February 21, 2023 00:36
aa37c2e to
75928ad
Compare
The diff algorithm is just the most basic thing possible, as even that is significantly better than having to compare stuff by eyeballing terminal output, or worse, opening an external diff tool. Eventually I may add collapsing of large common slices, or secondary diffing inside a line, this is just the first step on unblocking my productivity. It's implemented in a generic way so I can later reuse it for container differences as well (and differences on characters inside a line). I didn't spend any extra time on optimizing the algorithm further (apart from not using a STL map and/or allocating a new one in every iteration) as it's ran only on test failure which isn't really a critical path.
Returning an empty lambda doesn't solve anything, only hides bugs.
Ugh STL, imagine this was once considered "the normal way of doing things".
I'm tired of updating this every time I change ANYTHING in this file.
Don't just assume it works if color() works.
Need that for character diffs, heh.
Rather rudimentary at this point as it only handles the case of a single-line difference, not if for example two consecutive lines are both changed to something else. Maybe I'll figure that out later. Also contains a rather nasty "handling" of UTF-8 characters, in which case it just bails out of highlighting inside the line. Should be done in a better way eventually.
mosra
force-pushed
the
testsuite-file-diff
branch
from
February 21, 2023 09:45
54b1f7b to
731703e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TODO:
convert TestSuite::Tester test to it (maybe more? configuration tests?)no, make that opt-inDebug::inverseColor()to show this nicelyhandle UTF-8 properlyskip if it would break UTF-8 characters, for nowconvertlaterTestSuite::FileToStringetc to use itSimple diff algorithm is at http://pynash.org/2013/02/26/diff-in-50-lines/ .