Skip to content

Commit d8eb1b8

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix-patcher-mixed-eol-anchor
2 parents 216111c + 8faf6dc commit d8eb1b8

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

src/DiffEngine.Tests/ViewerProtocolTests.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,12 +383,20 @@ public async Task AMalformedMoveLineRejectsTheResponse()
383383
/// The routing contract: only the tray parses keys, and it tells its collections apart by
384384
/// prefix, which an inline key can never carry because a Windows path cannot put a colon
385385
/// there.
386+
/// <para>
387+
/// The path is folded the way InlineKey folds it, which is not the same on every platform: on
388+
/// Linux two paths differing only in case are two files. So the expectation is built from that
389+
/// rule rather than written out lower cased, which pinned the Windows answer everywhere and
390+
/// failed on Linux. That the two rules agree is TrackedKeyCaseTests; this is about the prefix.
391+
/// </para>
386392
/// </summary>
387393
[Test]
388394
public async Task TrackedKeysCannotCollideWithInlineKeys()
389395
{
390-
await Assert.That(TrackedKeys.ForMove(@"C:\Temp\A.txt")).IsEqualTo(@"move:c:\temp\a.txt");
391-
await Assert.That(TrackedKeys.ForDelete(@"C:\Code\B.txt")).IsEqualTo(@"delete:c:\code\b.txt");
396+
var move = @"C:\Temp\A.txt";
397+
var delete = @"C:\Code\B.txt";
398+
await Assert.That(TrackedKeys.ForMove(move)).IsEqualTo("move:" + InlineKey.FoldPath(move));
399+
await Assert.That(TrackedKeys.ForDelete(delete)).IsEqualTo("delete:" + InlineKey.FoldPath(delete));
392400
await Assert.That(TrackedKeys.IsTracked(@"move:c:\temp\a.txt")).IsTrue();
393401
await Assert.That(TrackedKeys.IsTracked(@"delete:c:\code\b.txt")).IsTrue();
394402
await Assert.That(TrackedKeys.IsTracked(InlineKey.For(@"C:\Repo\Tests.cs", 42))).IsFalse();

src/DiffEngine.Tests/WindowsProcessTests.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ public async Task TryTerminateProcess_WithWindowedProcess_GracefullyCloses()
142142

143143
await Assert.That(result).IsTrue();
144144

145-
// Verify process exited gracefully
146-
await Assert.That(process.WaitForExit(1000)).IsTrue();
145+
// Generous, because the margin here is the runner's, not the product's: a windowed
146+
// FakeDiffTool runs until something closes it, so waiting longer cannot turn a failure
147+
// into a pass. One second was a bet on a two core runner being idle
148+
await Assert.That(process.WaitForExit(30000)).IsTrue();
147149
}
148150
finally
149151
{
@@ -191,8 +193,12 @@ public async Task TryTerminateProcess_WithNonWindowedProcess_ForcefullyTerminate
191193

192194
await Assert.That(result).IsTrue();
193195

194-
// Verify process was terminated (should be immediate with forceful kill)
195-
await Assert.That(process.WaitForExit(1000)).IsTrue();
196+
// Waiting longer is not enough on its own here: this FakeDiffTool sleeps five seconds
197+
// and then exits by itself, so a wait past that passes whether it was terminated or
198+
// simply ran out. The exit code is what tells those apart - TryTerminateProcess passes
199+
// -1 to TerminateProcess, and running out returns 0
200+
await Assert.That(process.WaitForExit(30000)).IsTrue();
201+
await Assert.That(process.ExitCode).IsNotEqualTo(0);
196202
}
197203
finally
198204
{

0 commit comments

Comments
 (0)