diff --git a/src/DiffEngineViewer.Tests/IpcTests.List.verified.txt b/src/DiffEngineViewer.Tests/IpcTests.List.verified.txt index f1351e5b..2c61dfe8 100644 --- a/src/DiffEngineViewer.Tests/IpcTests.List.verified.txt +++ b/src/DiffEngineViewer.Tests/IpcTests.List.verified.txt @@ -1,13 +1,13 @@ -{ +{ Ok: true, Items: [ { Key: sampletests.cs|42, - Name: SampleTests.cs:42 + Name: sampletests.cs:42 }, { Key: othertests.cs|7, - Name: OtherTests.cs:7 + Name: othertests.cs:7 } ] } \ No newline at end of file diff --git a/src/DiffEngineViewer.Tests/IpcTests.cs b/src/DiffEngineViewer.Tests/IpcTests.cs index 12179326..ccc8e8dd 100644 --- a/src/DiffEngineViewer.Tests/IpcTests.cs +++ b/src/DiffEngineViewer.Tests/IpcTests.cs @@ -72,12 +72,17 @@ public async Task SettleForAnUnknownKeyIsHarmless() await Assert.That(fixture.Host.State.Queue.Count).IsEqualTo(1); } + /// + /// Lower case paths, so the key is the same text on every platform: it folds case only where + /// the file system does, and what this is pinning is the shape of a listing rather than which + /// of those the runner is. InlineKey has a test per platform of its own. + /// [Test] public Task List() { using var fixture = new ServerFixture(); - fixture.Send(Inline(Fixtures.Patch())); - fixture.Send(Inline(Fixtures.Patch("OtherTests.cs", 7, null, "new"))); + fixture.Send(Inline(Fixtures.Patch("sampletests.cs"))); + fixture.Send(Inline(Fixtures.Patch("othertests.cs", 7, null, "new"))); return Verify(fixture.Send(new(ViewerVerb.List))); } diff --git a/src/DiffEngineViewer.Tests/ViewerSessionTests.cs b/src/DiffEngineViewer.Tests/ViewerSessionTests.cs index 89192ad5..8b8adf18 100644 --- a/src/DiffEngineViewer.Tests/ViewerSessionTests.cs +++ b/src/DiffEngineViewer.Tests/ViewerSessionTests.cs @@ -22,7 +22,13 @@ public async Task EnqueueReplacesSameKey() await Assert.That(state.Queue[0].LeftText).IsEqualTo("second"); } + /// + /// Two paths differing only in case are one file here, so they are one entry. macOS runs this + /// one too — RunOn takes a single platform, and the folding itself has a test per platform in + /// ViewerProtocolTests. + /// [Test] + [RunOn(TUnit.Core.Enums.OS.Windows)] public async Task EnqueueKeyIgnoresPathCase() { var state = Fixtures.Inline( @@ -32,6 +38,21 @@ public async Task EnqueueKeyIgnoresPathCase() await Assert.That(state.Queue.Count).IsEqualTo(1); } + /// + /// And two files where the file system says so, so two entries. One key for both meant the + /// second patch took over the first's entry and settling either settled both. + /// + [Test] + [RunOn(TUnit.Core.Enums.OS.Linux)] + public async Task EnqueueKeyKeepsPathCaseWhereTheFilesDo() + { + var state = Fixtures.Inline( + Fixtures.Patch("A.cs", 1, "\"a\"", "first"), + Fixtures.Patch("a.CS", 1, "\"a\"", "second")); + + await Assert.That(state.Queue.Count).IsEqualTo(2); + } + [Test] public async Task SettleRemovesMatchingItem() {