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

TestSuite: multi-line string diff support #38

Merged
merged 7 commits into from Feb 21, 2023
Merged

Conversation

mosra
Copy link
Owner

@mosra mosra commented Dec 22, 2017

TODO:

  • everything
  • convert TestSuite::Tester test to it (maybe more? configuration tests?) no, make that opt-in
  • diff also the inside line itself, for now only if it's a single deletion and addition
    • implement Debug::inverseColor() to show this nicely
    • handle UTF-8 properly skip if it would break UTF-8 characters, for now
  • convert TestSuite::FileToString etc to use it later

image

Simple diff algorithm is at http://pynash.org/2013/02/26/diff-in-50-lines/ .

@mosra mosra self-assigned this Dec 22, 2017
@mosra mosra added this to TODO in TestSuite via automation Dec 22, 2017
@mosra mosra changed the title TestSuite: multi-line string diff support [WIP] TestSuite: multi-line string diff support Dec 22, 2017
@coveralls
Copy link

Coverage Status

Coverage remained the same at 96.167% when pulling 3812f87 on testsuite-file-diff into e94609d on master.

@mosra mosra force-pushed the testsuite-file-diff branch 2 times, most recently from 74207f6 to 170a0cb Compare February 20, 2023 20:14
@codecov
Copy link

codecov bot commented Feb 20, 2023

Codecov Report

Base: 98.04% // Head: 98.05% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (170a0cb) compared to base (ad48bb4).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head 170a0cb differs from pull request most recent head 05dfcb1. Consider uploading reports for the commit 05dfcb1 to get more accurate results

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              
Impacted Files Coverage Δ
...rc/Corrade/TestSuite/Compare/Implementation/Diff.h 100.00% <100.00%> (ø)
src/Corrade/TestSuite/Compare/String.cpp 100.00% <100.00%> (ø)
src/Corrade/TestSuite/Compare/String.h 100.00% <100.00%> (ø)

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mosra mosra force-pushed the testsuite-file-diff branch 2 times, most recently from 05dfcb1 to aa37c2e Compare February 21, 2023 00:21
@mosra mosra added this to the 2023.0a milestone Feb 21, 2023
@mosra mosra changed the title [WIP] TestSuite: multi-line string diff support TestSuite: multi-line string diff support Feb 21, 2023
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 mosra merged commit 731703e into master Feb 21, 2023
TestSuite automation moved this from TODO to Done Feb 21, 2023
@mosra mosra deleted the testsuite-file-diff branch February 21, 2023 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
TestSuite
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants