Skip to content

Commit 4d22727

Browse files
committed
Update packages, fix test code style and remove unused test code.
1 parent aa2cb6f commit 4d22727

File tree

64 files changed

+6753
-6866
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+6753
-6866
lines changed

.github/workflows/build-and-test.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,14 @@ jobs:
4242
- name: Build
4343
run: dotnet build --no-restore
4444
- name: Run Tests
45-
run: dotnet test --no-build -- xunit.parallelizeAssembly=true xunit.parallelizeTestCollections=true xunit.maxParallelThreads=-1
45+
run: |
46+
dotnet test \
47+
--no-build \
48+
-- \
49+
--xunit-info --output Detailed \
50+
xUnit.DiagnosticMessages=true \
51+
xUnit.Explicit=on \
52+
xUnit.MaxParallelThreads=unlimited \
53+
xUnit.ParallelAlgorithm=aggressive \
54+
xUnit.ParallelizeAssembly=true \
55+
xUnit.ParallelizeTestCollections=true

Loretta.sln.DotSettings

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
22
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=CheckNamespace/@EntryIndexedValue">DO_NOT_SHOW</s:String>
3-
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RemoveRedundantBraces/@EntryIndexedValue">SUGGESTION</s:String>
3+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RemoveRedundantBraces/@EntryIndexedValue">DO_NOT_SHOW</s:String>
44
<s:Boolean x:Key="/Default/UserDictionary/Words/=elseif_0027s/@EntryIndexedValue">True</s:Boolean>
55
<s:Boolean x:Key="/Default/UserDictionary/Words/=exponentiate/@EntryIndexedValue">True</s:Boolean>
6+
<s:Boolean x:Key="/Default/UserDictionary/Words/=lexes/@EntryIndexedValue">True</s:Boolean>
67
<s:Boolean x:Key="/Default/UserDictionary/Words/=lua_0027s/@EntryIndexedValue">True</s:Boolean>
78
<s:Boolean x:Key="/Default/UserDictionary/Words/=nilable/@EntryIndexedValue">True</s:Boolean>
89
<s:Boolean x:Key="/Default/UserDictionary/Words/=reparsed/@EntryIndexedValue">True</s:Boolean>

build/LibraryProject.props

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
<PropertyGroup>
66
<TargetFrameworks>net8.0;netstandard2.0</TargetFrameworks>
7-
<TargetFrameworks Condition="'$(IsUnusedAnalysis)' == 'true'">net8.0</TargetFrameworks>
87
<OutputType>Library</OutputType>
98
<NeutralLanguage>en-US</NeutralLanguage>
109
</PropertyGroup>
@@ -45,7 +44,7 @@
4544
</PropertyGroup>
4645

4746
<ItemGroup>
48-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
47+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
4948
<PrivateAssets>all</PrivateAssets>
5049
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5150
</PackageReference>

src/Compilers/Core/Portable/Loretta.CodeAnalysis.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020

2121
<!-- Packages that we need from .NET 6+ on .NET Standard 2.0 -->
2222
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
23-
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
24-
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
25-
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
26-
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
27-
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />
28-
<PackageReference Include="System.Memory" Version="4.5.5" />
23+
<PackageReference Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
24+
<PackageReference Include="System.Collections.Immutable" Version="9.0.3" />
25+
<PackageReference Include="System.Memory" Version="4.6.2" />
26+
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.1" />
27+
<PackageReference Include="System.Text.Encoding.CodePages" Version="9.0.3" />
28+
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.6.2" />
2929
</ItemGroup>
3030

3131
<ItemGroup>

src/Compilers/Core/Test/Utilities/Assert/AssertEx.cs

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,49 +13,50 @@ namespace Loretta.Test.Utilities
1313
/// </summary>
1414
public static class AssertEx
1515
{
16-
public static void Equal(bool[,] expected, Func<int, int, bool> getResult, int size) =>
17-
Equal<bool>(expected, getResult, (b1, b2) => b1 == b2, b => b ? "true" : "false", "{0,-6:G}", size);
16+
public static void Equal(bool[,] expected, Func<int, int, bool> getResult, int size)
17+
=> Equal(
18+
expected,
19+
getResult,
20+
static (b1, b2) => b1 == b2,
21+
static b => b ? "true" : "false",
22+
"{0,-6:G}",
23+
size);
1824

19-
public static void Equal<T>(T[,] expected, Func<int, int, T> getResult, Func<T, T, bool> valuesEqual, Func<T, string> printValue, string format, int size)
25+
public static void Equal<T>(
26+
T[,] expected,
27+
Func<int, int, T> getResult,
28+
Func<T, T, bool> valuesEqual,
29+
Func<T, string> printValue,
30+
string format,
31+
int size)
2032
{
21-
bool mismatch = false;
22-
for (int i = 0; i < size; i++)
33+
var mismatch = false;
34+
for (var i = 0; i < size; i++)
2335
{
24-
for (int j = 0; j < size; j++)
36+
for (var j = 0; j < size; j++)
2537
{
26-
if (!valuesEqual(expected[i, j], getResult(i, j)))
27-
{
28-
mismatch = true;
29-
}
38+
if (!valuesEqual(expected[i, j], getResult(i, j))) mismatch = true;
3039
}
3140
}
3241

33-
if (mismatch)
42+
if (!mismatch) return;
43+
var builder = new StringBuilder();
44+
builder.AppendLine("Actual result: ");
45+
for (var i = 0; i < size; i++)
3446
{
35-
var builder = new StringBuilder();
36-
builder.AppendLine("Actual result: ");
37-
for (int i = 0; i < size; i++)
47+
builder.Append("{ ");
48+
for (var j = 0; j < size; j++)
3849
{
39-
builder.Append("{ ");
40-
for (int j = 0; j < size; j++)
41-
{
42-
string resultWithComma = printValue(getResult(i, j));
43-
if (j < size - 1)
44-
{
45-
resultWithComma += ",";
46-
}
50+
var resultWithComma = printValue(getResult(i, j));
51+
if (j < size - 1) resultWithComma += ",";
4752

48-
builder.Append(string.Format(format, resultWithComma));
49-
if (j < size - 1)
50-
{
51-
builder.Append(' ');
52-
}
53-
}
54-
builder.AppendLine("},");
53+
builder.Append(string.Format(format, resultWithComma));
54+
if (j < size - 1) builder.Append(' ');
5555
}
56-
57-
Assert.True(false, builder.ToString());
56+
builder.AppendLine("},");
5857
}
58+
59+
Assert.Fail(builder.ToString());
5960
}
6061
}
6162
}

src/Compilers/Core/Test/Utilities/Assert/ConditionalFactAttribute.cs

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public ConditionalTheoryAttribute(params Type[] skipConditions)
4040
foreach (var skipCondition in skipConditions)
4141
{
4242
var condition = (ExecutionCondition) Activator.CreateInstance(skipCondition);
43-
if (condition.ShouldSkip)
43+
if (condition!.ShouldSkip)
4444
{
4545
base.Skip = Reason ?? condition.SkipReason;
4646
break;
@@ -52,44 +52,63 @@ public ConditionalTheoryAttribute(params Type[] skipConditions)
5252
public abstract class ExecutionCondition
5353
{
5454
public abstract bool ShouldSkip { get; }
55+
5556
public abstract string SkipReason { get; }
5657
}
5758

5859
public static class ExecutionConditionUtil
5960
{
60-
public static ExecutionArchitecture Architecture => IntPtr.Size switch
61-
{
62-
4 => ExecutionArchitecture.x86,
63-
8 => ExecutionArchitecture.x64,
64-
_ => throw new InvalidOperationException($"Unrecognized pointer size {IntPtr.Size}")
65-
};
66-
public static ExecutionConfiguration Configuration =>
61+
// ReSharper disable once BuiltInTypeReferenceStyleForMemberAccess
62+
public static ExecutionArchitecture Architecture
63+
=> IntPtr.Size switch
64+
{
65+
4 => ExecutionArchitecture.X86,
66+
8 => ExecutionArchitecture.X64,
67+
// ReSharper disable once BuiltInTypeReferenceStyleForMemberAccess
68+
_ => throw new InvalidOperationException($"Unrecognized pointer size {IntPtr.Size}"),
69+
};
70+
71+
public static ExecutionConfiguration Configuration
72+
=>
6773
#if DEBUG
68-
ExecutionConfiguration.Debug;
74+
ExecutionConfiguration.Debug;
6975
#elif RELEASE
7076
ExecutionConfiguration.Release;
7177
#else
7278
#error Unsupported Configuration
7379
#endif
7480

7581
public static bool IsWindows => Path.DirectorySeparatorChar == '\\';
82+
7683
public static bool IsUnix => !IsWindows;
77-
public static bool IsMacOS => RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
84+
85+
public static bool IsMacOs => RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
86+
7887
public static bool IsLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
88+
7989
public static bool IsDesktop => RuntimeUtilities.IsDesktopRuntime;
90+
8091
public static bool IsWindowsDesktop => IsWindows && IsDesktop;
92+
8193
public static bool IsMonoDesktop => Type.GetType("Mono.Runtime") != null;
94+
8295
public static bool IsMono => MonoHelpers.IsRunningOnMono();
96+
8397
public static bool IsCoreClr => !IsDesktop;
98+
8499
public static bool IsCoreClrUnix => IsCoreClr && IsUnix;
100+
85101
public static bool IsMonoOrCoreClr => IsMono || IsCoreClr;
86-
public static bool RuntimeSupportsCovariantReturnsOfClasses => Type.GetType("System.Runtime.CompilerServices.RuntimeFeature")?.GetField("CovariantReturnsOfClasses") != null;
102+
103+
public static bool RuntimeSupportsCovariantReturnsOfClasses
104+
=> Type.GetType("System.Runtime.CompilerServices.RuntimeFeature")?.GetField("CovariantReturnsOfClasses")
105+
!= null;
87106
}
88107

89108
public enum ExecutionArchitecture
90109
{
91-
x86,
92-
x64,
110+
X86,
111+
X64,
93112
}
94113

95114
public enum ExecutionConfiguration

0 commit comments

Comments
 (0)