Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/DiffEngineViewer.Tests/IpcTests.List.verified.txt
Original file line number Diff line number Diff line change
@@ -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
}
]
}
9 changes: 7 additions & 2 deletions src/DiffEngineViewer.Tests/IpcTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,17 @@ public async Task SettleForAnUnknownKeyIsHarmless()
await Assert.That(fixture.Host.State.Queue.Count).IsEqualTo(1);
}

/// <summary>
/// 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.
/// </summary>
[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)));
}
Expand Down
21 changes: 21 additions & 0 deletions src/DiffEngineViewer.Tests/ViewerSessionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ public async Task EnqueueReplacesSameKey()
await Assert.That(state.Queue[0].LeftText).IsEqualTo("second");
}

/// <summary>
/// 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.
/// </summary>
[Test]
[RunOn(TUnit.Core.Enums.OS.Windows)]
public async Task EnqueueKeyIgnoresPathCase()
{
var state = Fixtures.Inline(
Expand All @@ -32,6 +38,21 @@ public async Task EnqueueKeyIgnoresPathCase()
await Assert.That(state.Queue.Count).IsEqualTo(1);
}

/// <summary>
/// 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.
/// </summary>
[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()
{
Expand Down
Loading