Skip to content

Commit

Permalink
merge origin/main
Browse files Browse the repository at this point in the history
  • Loading branch information
meziantou committed Dec 22, 2024
2 parents ec2588d + 66a5ec9 commit 394798a
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 25 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ jobs:
name: ${{ steps.compute-artifact-name.outputs.artifact-name }}
if-no-files-found: error
retention-days: 3
path: ${{ env.TestResultsDirectory }}/**/*
path: |
**/*.binlog
${{ env.TestResultsDirectory }}/**/*
build_and_test_windows_x86:
runs-on: ${{ matrix.runs-on }}
Expand Down Expand Up @@ -184,7 +186,9 @@ jobs:
name: ${{ steps.compute-artifact-name.outputs.artifact-name }}
if-no-files-found: error
retention-days: 3
path: ${{ env.TestResultsDirectory }}/**/*
path: |
**/*.binlog
${{ env.TestResultsDirectory }}/**/*
test_trimming:
runs-on: ubuntu-24.04
Expand Down
4 changes: 4 additions & 0 deletions eng/validate-testprojects-configuration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ $Errors = $Projs | Foreach-Object -ThrottleLimit 5 -Parallel {
if ($RefTfm -eq "netstandard2.1") {
continue;
}

if ($RefTfm -eq "net462" -and $TestProjectTfms.Contains("net472")) {
continue;
}

if ($RefTfm -eq "net462" -and $TestProjectTfms.Contains("net472")) {
continue;
Expand Down
1 change: 0 additions & 1 deletion tests/ArgumentsPrinter/ArgumentsPrinter.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>$(LatestTargetFrameworks)</TargetFrameworks>
Expand Down
2 changes: 1 addition & 1 deletion tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
</PackageReference>
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(LatestTargetFrameworks)</TargetFrameworks>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(LatestTargetFrameworks)</TargetFrameworks>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Automation;
using FluentAssertions;
using System.Windows.Automation;
using Meziantou.Framework.InlineSnapshotTesting.SnapshotUpdateStrategies;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using TestUtilities;
using Xunit;

Expand Down Expand Up @@ -89,18 +83,18 @@ internal void Ask(int buttonIndex, bool applyToAllFiles, PromptConfigurationMode
{
var result = Invoke(new PromptContext("path.cs", "dummy test", ParentProcessInfo: null), buttonIndex, applyToAllFiles);

result.Mode.Should().Be(expectedMode);
result.Scope.Should().Be(expectedScope);
result.RememberPeriod.Should().Be(TimeSpan.FromHours(1));
Assert.Equal(expectedMode, result.Mode);
Assert.Equal(expectedScope, result.Scope);
Assert.Equal(TimeSpan.FromHours(1), result.RememberPeriod);
}

[Fact, RunIf(FactOperatingSystem.Windows)]
internal void Ask_Cancel()
{
var result = Invoke(new PromptContext("path.cs", "dummy test", ParentProcessInfo: null), buttonIndex: 4, applyToAllFiles: false);

result.Mode.Should().Be(PromptConfigurationMode.Disallow);
result.Scope.Should().Be(PromptConfigurationScope.CurrentSnapshot);
result.RememberPeriod.Should().BeLessThanOrEqualTo(TimeSpan.Zero);
Assert.Equal(PromptConfigurationMode.Disallow, result.Mode);
Assert.Equal(PromptConfigurationScope.CurrentSnapshot, result.Scope);
Assert.True(result.RememberPeriod <= TimeSpan.Zero);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@

namespace Meziantou.Framework.Tests;

public class DebouceExtensionsTests
public sealed class DebounceExtensionsTests
{
[Fact]
public void Debounce_CallActionsWithArgumentsOfTheLastCall()
{
using var resetEvent = new ManualResetEventSlim(initialState: false);
int lastArg = default;
var lastArg = 0;
var count = 0;
var debounced = DebounceExtensions.Debounce<int>(i =>
{
lastArg = i;
count++;
Interlocked.CompareExchange(ref lastArg, i, 0);
Interlocked.Increment(ref count);
resetEvent.Set();
}, TimeSpan.FromMilliseconds(10));
}, TimeSpan.FromMilliseconds(200));

debounced(1);
debounced(2);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(LatestTargetFrameworks)</TargetFrameworks>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<CompatibilityRecord>true</CompatibilityRecord>
</PropertyGroup>

<ItemGroup Condition=" $(TargetFramework) == 'net472' ">
<ItemGroup Condition="'$(TargetFramework)' == 'net472' ">
<Reference Include="System.Windows" />
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions tests/TestUtilities/TestUtilities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
</ItemGroup>

</Project>

0 comments on commit 394798a

Please sign in to comment.