Skip to content

Commit 7b04b65

Browse files
authored
Fix the two Linux tests the inline key change broke (#765)
Both encoded the folding that is now platform dependent, and both are in DiffEngineViewer.Tests, which is the one test project the Linux legs of CI build. I checked DiffEngine.Tests for this and stopped there. EnqueueKeyIgnoresPathCase asserts that two paths differing only in case are one entry, which is true where the file system says so and false on Linux. It is pinned to Windows now, with the Linux half beside it asserting the two entries that platform should give. IpcTests.List snapshotted keys derived from mixed case paths, so the snapshot said which platform it ran on. Its paths are lower case now, so the key is the same text everywhere and the snapshot is back to pinning the shape of a listing. Checked by forcing the folding off and running the viewer tests: List passes, and two case-differing paths do produce the two entries the new test expects.
1 parent a006a3c commit 7b04b65

3 files changed

Lines changed: 31 additions & 5 deletions

File tree

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
{
1+
{
22
Ok: true,
33
Items: [
44
{
55
Key: sampletests.cs|42,
6-
Name: SampleTests.cs:42
6+
Name: sampletests.cs:42
77
},
88
{
99
Key: othertests.cs|7,
10-
Name: OtherTests.cs:7
10+
Name: othertests.cs:7
1111
}
1212
]
1313
}

src/DiffEngineViewer.Tests/IpcTests.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,17 @@ public async Task SettleForAnUnknownKeyIsHarmless()
7272
await Assert.That(fixture.Host.State.Queue.Count).IsEqualTo(1);
7373
}
7474

75+
/// <summary>
76+
/// Lower case paths, so the key is the same text on every platform: it folds case only where
77+
/// the file system does, and what this is pinning is the shape of a listing rather than which
78+
/// of those the runner is. InlineKey has a test per platform of its own.
79+
/// </summary>
7580
[Test]
7681
public Task List()
7782
{
7883
using var fixture = new ServerFixture();
79-
fixture.Send(Inline(Fixtures.Patch()));
80-
fixture.Send(Inline(Fixtures.Patch("OtherTests.cs", 7, null, "new")));
84+
fixture.Send(Inline(Fixtures.Patch("sampletests.cs")));
85+
fixture.Send(Inline(Fixtures.Patch("othertests.cs", 7, null, "new")));
8186

8287
return Verify(fixture.Send(new(ViewerVerb.List)));
8388
}

src/DiffEngineViewer.Tests/ViewerSessionTests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ public async Task EnqueueReplacesSameKey()
2222
await Assert.That(state.Queue[0].LeftText).IsEqualTo("second");
2323
}
2424

25+
/// <summary>
26+
/// Two paths differing only in case are one file here, so they are one entry. macOS runs this
27+
/// one too — RunOn takes a single platform, and the folding itself has a test per platform in
28+
/// ViewerProtocolTests.
29+
/// </summary>
2530
[Test]
31+
[RunOn(TUnit.Core.Enums.OS.Windows)]
2632
public async Task EnqueueKeyIgnoresPathCase()
2733
{
2834
var state = Fixtures.Inline(
@@ -32,6 +38,21 @@ public async Task EnqueueKeyIgnoresPathCase()
3238
await Assert.That(state.Queue.Count).IsEqualTo(1);
3339
}
3440

41+
/// <summary>
42+
/// And two files where the file system says so, so two entries. One key for both meant the
43+
/// second patch took over the first's entry and settling either settled both.
44+
/// </summary>
45+
[Test]
46+
[RunOn(TUnit.Core.Enums.OS.Linux)]
47+
public async Task EnqueueKeyKeepsPathCaseWhereTheFilesDo()
48+
{
49+
var state = Fixtures.Inline(
50+
Fixtures.Patch("A.cs", 1, "\"a\"", "first"),
51+
Fixtures.Patch("a.CS", 1, "\"a\"", "second"));
52+
53+
await Assert.That(state.Queue.Count).IsEqualTo(2);
54+
}
55+
3556
[Test]
3657
public async Task SettleRemovesMatchingItem()
3758
{

0 commit comments

Comments
 (0)