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
10 changes: 5 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ build_script:
- pwsh: |
if ($isWindows) {
Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./dotnet-install.ps1"
./dotnet-install.ps1 -JSonFile src/global.json -Architecture x64 -InstallDir 'C:\Program Files\dotnet'
./dotnet-install.ps1 -JSonFile global.json -Architecture x64 -InstallDir 'C:\Program Files\dotnet'
dotnet build src --configuration Release
dotnet test src --configuration Release --no-build --no-restore
dotnet test --solution src/DiffEngine.slnx --configuration Release --no-build --no-restore
dotnet publish src/DiffEngine.AotTests/DiffEngine.AotTests.csproj --configuration Release
}
else {
Invoke-WebRequest "https://dot.net/v1/dotnet-install.sh" -OutFile "./dotnet-install.sh"
sudo chmod u+x dotnet-install.sh
if ($isMacOS) {
sudo ./dotnet-install.sh --jsonfile src/global.json --architecture x64 --install-dir '/usr/local/share/dotnet'
sudo ./dotnet-install.sh --jsonfile global.json --architecture x64 --install-dir '/usr/local/share/dotnet'
} else {
sudo ./dotnet-install.sh --jsonfile src/global.json --architecture x64 --install-dir '/usr/share/dotnet'
sudo ./dotnet-install.sh --jsonfile global.json --architecture x64 --install-dir '/usr/share/dotnet'
}
dotnet build src --configuration Release-NotWindows
dotnet test src --configuration Release-NotWindows --no-build --no-restore
dotnet test --solution src/DiffEngine.slnx --configuration Release-NotWindows --no-build --no-restore
dotnet publish src/DiffEngine.AotTests/DiffEngine.AotTests.csproj --configuration Release-NotWindows
}
on_failure:
Expand Down
11 changes: 6 additions & 5 deletions claude.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
dotnet build src --configuration Release

# Run all tests
dotnet test src --configuration Release
dotnet test --project src/DiffEngine.Tests --configuration Release
dotnet test --project src/DiffEngineTray.Tests --configuration Release

# Run a single test file
dotnet test src/DiffEngine.Tests --filter "FullyQualifiedName~ClassName"
# Run a single test project with filter
dotnet test --project src/DiffEngine.Tests --configuration Release --filter "FullyQualifiedName~ClassName"

# Run a specific test
dotnet test src/DiffEngine.Tests --filter "FullyQualifiedName=DiffEngine.Tests.ClassName.TestMethod"
dotnet test --project src/DiffEngine.Tests --configuration Release --filter "FullyQualifiedName=DiffEngine.Tests.ClassName.TestMethod"
```

**SDK Requirements:** .NET 10 SDK (see `src/global.json`). The project uses preview/prerelease SDK features.
Expand Down Expand Up @@ -66,4 +67,4 @@ DiffEngine is a library that manages launching and cleanup of diff tools for sna
- Tool discovery uses wildcard path matching (`WildcardFileFinder`) to find executables in common install locations
- Tool order can be customized via `DiffEngine_ToolOrder` environment variable
- `DisabledChecker` respects `DiffEngine_Disabled` env var
- Tests use xUnit and Verify for snapshot testing
- Tests use TUnit and Verify for snapshot testing
2 changes: 1 addition & 1 deletion docs/diff-tool.custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ New tools are added to the top of the order, the last tool added will resolve be
```cs
await DiffRunner.LaunchAsync(tempFile, targetFile);
```
<sup><a href='/src/DiffEngine.Tests/DiffRunnerTests.cs#L65-L69' title='Snippet source file'>snippet source</a> | <a href='#snippet-DiffRunnerLaunch' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/DiffEngine.Tests/DiffRunnerTests.cs#L67-L71' title='Snippet source file'>snippet source</a> | <a href='#snippet-DiffRunnerLaunch' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Alternatively the instance returned from `AddTool*` can be used to explicitly launch that tool.
Expand Down
3 changes: 3 additions & 0 deletions src/global.json → global.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"version": "10.0.102",
"allowPrerelease": true,
"rollForward": "latestFeature"
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
18 changes: 9 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ A tool can be launched using the following:
```cs
await DiffRunner.LaunchAsync(tempFile, targetFile);
```
<sup><a href='/src/DiffEngine.Tests/DiffRunnerTests.cs#L65-L69' title='Snippet source file'>snippet source</a> | <a href='#snippet-DiffRunnerLaunch' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/DiffEngine.Tests/DiffRunnerTests.cs#L67-L71' title='Snippet source file'>snippet source</a> | <a href='#snippet-DiffRunnerLaunch' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Note that this method will respect the above [difference behavior](/docs/diff-tool.md#detected-difference-behavior) in terms of Auto refresh and MDI behaviors.
Expand All @@ -115,7 +115,7 @@ A tool can be closed using the following:
```cs
DiffRunner.Kill(file1, file2);
```
<sup><a href='/src/DiffEngine.Tests/DiffRunnerTests.cs#L78-L82' title='Snippet source file'>snippet source</a> | <a href='#snippet-DiffRunnerKill' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/DiffEngine.Tests/DiffRunnerTests.cs#L81-L85' title='Snippet source file'>snippet source</a> | <a href='#snippet-DiffRunnerKill' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Note that this method will respect the above [difference behavior](/docs/diff-tool.md#detected-difference-behavior) in terms of MDI behavior.
Expand Down Expand Up @@ -170,37 +170,37 @@ var isAppVeyor = BuildServerDetector.IsAppVeyor;
<!-- snippet: BuildServerDetectorDetectedOverride -->
<a id='snippet-BuildServerDetectorDetectedOverride'></a>
```cs
[Fact]
[Test]
public async Task SetDetectedPersistsInAsyncContext()
{
var original = BuildServerDetector.Detected;
try
{
BuildServerDetector.Detected = true;
Assert.True(BuildServerDetector.Detected);
await Assert.That(BuildServerDetector.Detected).IsTrue();

await Task.Delay(1);

Assert.True(BuildServerDetector.Detected);
await Assert.That(BuildServerDetector.Detected).IsTrue();
}
finally
{
BuildServerDetector.Detected = original;
}
}

[Fact]
[Test]
public async Task SetDetectedDoesNotLeakToOtherContexts()
{
var parentValue = BuildServerDetector.Detected;

await Task.Run(() =>
await Task.Run(async () =>
{
BuildServerDetector.Detected = true;
Assert.True(BuildServerDetector.Detected);
await Assert.That(BuildServerDetector.Detected).IsTrue();
});

Assert.Equal(parentValue, BuildServerDetector.Detected);
await Assert.That(BuildServerDetector.Detected).IsEqualTo(parentValue);
}
```
<sup><a href='/src/DiffEngine.Tests/BuildServerDetectorTest.cs#L27-L62' title='Snippet source file'>snippet source</a> | <a href='#snippet-BuildServerDetectorDetectedOverride' title='Start of snippet'>anchor</a></sup>
Expand Down
4 changes: 2 additions & 2 deletions src/DiffEngine.Tests/AiCliDetectorTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
public class AiCliDetectorTest
{
[Fact]
[Test]
public void Props()
{
// ReSharper disable UnusedVariable
Expand All @@ -16,4 +16,4 @@ public void Props()

// ReSharper restore UnusedVariable
}
}
}
16 changes: 8 additions & 8 deletions src/DiffEngine.Tests/BuildServerDetectorTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
public class BuildServerDetectorTest
{
[Fact]
[Test]
public void Props()
{
// ReSharper disable UnusedVariable
Expand All @@ -26,37 +26,37 @@ public void Props()

#region BuildServerDetectorDetectedOverride

[Fact]
[Test]
public async Task SetDetectedPersistsInAsyncContext()
{
var original = BuildServerDetector.Detected;
try
{
BuildServerDetector.Detected = true;
Assert.True(BuildServerDetector.Detected);
await Assert.That(BuildServerDetector.Detected).IsTrue();

await Task.Delay(1);

Assert.True(BuildServerDetector.Detected);
await Assert.That(BuildServerDetector.Detected).IsTrue();
}
finally
{
BuildServerDetector.Detected = original;
}
}

[Fact]
[Test]
public async Task SetDetectedDoesNotLeakToOtherContexts()
{
var parentValue = BuildServerDetector.Detected;

await Task.Run(() =>
await Task.Run(async () =>
{
BuildServerDetector.Detected = true;
Assert.True(BuildServerDetector.Detected);
await Assert.That(BuildServerDetector.Detected).IsTrue();
});

Assert.Equal(parentValue, BuildServerDetector.Detected);
await Assert.That(BuildServerDetector.Detected).IsEqualTo(parentValue);
}

#endregion
Expand Down
20 changes: 10 additions & 10 deletions src/DiffEngine.Tests/DefinitionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ public class DefinitionsTest
static string SourceDirectory { get; } = Path.GetDirectoryName(GetSourceFile())!;
static string GetSourceFile([CallerFilePath] string path = "") => path;

[Fact]
[Test]
public void WriteList()
{
var md = Path.Combine(SourceDirectory, "diffToolList.include.md");
Expand All @@ -16,10 +16,10 @@ public void WriteList()
}
}

[Fact]
public void EnvironmentVariablesShouldBeUnique()
[Test]
public async Task EnvironmentVariablesShouldBeUnique()
{
static void FindDuplicates(Func<OsSupport, OsSettings?> selectOs)
static async Task FindDuplicates(Func<OsSupport, OsSettings?> selectOs)
{
var findDuplicates = Definitions.Tools
.Select(_ => _.OsSupport)
Expand All @@ -28,13 +28,13 @@ static void FindDuplicates(Func<OsSupport, OsSettings?> selectOs)
.GroupBy(_ => _);
foreach (var group in findDuplicates)
{
Assert.Single(group);
await Assert.That(group).HasSingleItem();
}
}

FindDuplicates(_ => _.Windows);
FindDuplicates(_ => _.Osx);
FindDuplicates(_ => _.Linux);
await FindDuplicates(_ => _.Windows);
await FindDuplicates(_ => _.Osx);
await FindDuplicates(_ => _.Linux);
}

static void AddToolLink(TextWriter writer, Definition tool)
Expand Down Expand Up @@ -65,7 +65,7 @@ static string GetOsSupport(OsSupport osSupport)
return builder.ToString();
}

[Fact]
[Test]
public void WriteDefaultOrder()
{
var md = Path.Combine(SourceDirectory, "defaultOrder.include.md");
Expand All @@ -78,7 +78,7 @@ public void WriteDefaultOrder()
}
}

[Fact]
[Test]
public void WriteFoundTools()
{
var md = Path.Combine(SourceDirectory, "diffTools.include.md");
Expand Down
10 changes: 5 additions & 5 deletions src/DiffEngine.Tests/DiffEngine.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net10.0</TargetFrameworks>
<TargetFramework>net10.0</TargetFramework>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net10.0;net48</TargetFrameworks>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<NoWarn>$(NoWarn);SYSLIB0012</NoWarn>
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<Using Include="DiffEngine" />
<PackageReference Include="MarkdownSnippets.MsBuild" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Argon" />
<PackageReference Include="xunit.v3" />
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" />
<PackageReference Include="ProjectDefaults" PrivateAssets="all" />
<ProjectReference Include="..\DiffEngine\DiffEngine.csproj" />
<Compile Remove="DefinitionsTest.cs" Condition="'$(TargetFramework)' == 'net9.0'" />
<PackageReference Include="TUnit" />
</ItemGroup>
</Project>
</Project>
6 changes: 3 additions & 3 deletions src/DiffEngine.Tests/DiffEngineTrayTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma warning disable CS0618 // Type or member is obsolete
public class DiffEngineTrayTest
{
[Fact]
public void IsRunning() =>
Assert.False(DiffEngineTray.IsRunning);
[Test]
public async Task IsRunning() =>
await Assert.That(DiffEngineTray.IsRunning).IsFalse();
}
Loading