1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 01:17:46 +00:00

LibDiff: Fix wrong index used when prepending context lines

`i` is used as the index for 'old lines' in diff generation, not 'new
lines'. Using the wrong index would mean that for certain diffs the
prefixed context information would have wrong content, and could even
result in a crash.

Fix this, and add a test for an input which was previously crashing.
This commit is contained in:
Shannon Booth 2023-09-10 18:49:05 +12:00 committed by Sam Atkins
parent 4adbf1d041
commit b738929195
4 changed files with 117 additions and 1 deletions

View file

@ -0,0 +1,7 @@
set(TEST_SOURCES
TestDiff.cpp
)
foreach(source IN LISTS TEST_SOURCES)
serenity_test("${source}" LibDiff LIBS LibDiff)
endforeach()