Repository navigation
test: Expand test suite to perl and python peers - #10
Conversation
🔍 CI ResultsOverall: ✅ All 12 lanes passed TL;DR: ✅ All clean: 88 tests (253 assertions) in 12 lanes, 25 files scanned, 56 files styled. Summary by PHP Version
Quality Metrics
CI powered by horde-components • View full results |
I looked into the test suites of Perl and python diff libraries to look for edge cases we might want to cover. At least the MappedDiff looks like it's broken
1a69886 to
a14ad22
Compare
|
Some Review Findings: he assertion that cannot fail ThreeWayTest.php $this->assertStringNotContainsString( Comments that no longer match the code In NativeEngine::diff(), unset($this->seq) became $this->seq = null (same for in_seq and lcs), with a comment that unset is illegal because a subclass might add property hooks. On PHP 8.4 both forms succeed: unset leaves the typed property uninitialized, and the later $this->seq[0] = $yoff - 1 in _diag() initializes it, with no warning. These properties have no hooks, and a subclass cannot add hooks to them. Resetting with $this->seq = [] and $this->in_seq = [] would match how _diag() uses them. The new $k = null plus is_int($k) guard is also narrower than the comment suggests. _diag() sets in_seq to [] before the loop, and the elseif runs only when in_seq[$y] is already set, which happens in _lcsPos() after $k is assigned. On that path $k is already a positive int, so the guard does not change results. The disabled assert($y <= $this->seq[$k]) (maintaina-com#12) is unchanged, and nothing new hits that elseif. Tests that pass for a weaker reason testAutoEngineUsesXdiffWhenAvailable skips unless xdiff is loaded, then accepts any diff that contains an AddOperation. NativeEngine produces that too for an appended line, so the test does not show that 'auto' selected XdiffEngine. EngineTest::testStringEngine() is still the pre-existing trap the new comment describes: expectException() makes every line after the headerless patch unreachable, including the context-patch assertions. testContextPatchRoundtrip covers that case separately. The old method still reports success without running the rest. |
|
FYI @ralflang |
I looked into the test suites of Perl and python diff libraries to look
for edge cases we might want to cover.
At least the MappedDiff looks like it's broken