Use collection expressions in more cases in tests
このコミットが含まれているのは:
1 親
a3c0d167f8
コミット
0e24e68b10
2ファイル変更
+29
-39
検索条件に一致するファイルはありません
@@ -1,7 +1,6 @@
|
||||
extern alias Core;
|
||||
extern alias D3D12;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
@@ -1421,19 +1420,13 @@ public class DiagnosticsTests
|
||||
private static void VerifyGeneratedDiagnostics<TGenerator>(string source, params string[] diagnosticsIds)
|
||||
where TGenerator : class, IIncrementalGenerator, new()
|
||||
{
|
||||
// Ensure ComputeSharp.Core and ComputeSharp are loaded
|
||||
Type hlslType = typeof(Core::ComputeSharp.Hlsl);
|
||||
Type computeShaderType = typeof(D3D12::ComputeSharp.IComputeShader);
|
||||
|
||||
// Prepare the two additional metadata references
|
||||
IEnumerable<MetadataReference> additionalReferences = new[]
|
||||
{
|
||||
MetadataReference.CreateFromFile(hlslType.Assembly.Location),
|
||||
MetadataReference.CreateFromFile(computeShaderType.Assembly.Location)
|
||||
};
|
||||
|
||||
// Get all assembly references for the loaded assemblies (easy way to pull in all necessary dependencies)
|
||||
IEnumerable<MetadataReference> metadataReferences = Net80.References.All.Concat(additionalReferences);
|
||||
// Get all assembly references for the .NET TFM and ComputeSharp
|
||||
IEnumerable<MetadataReference> metadataReferences =
|
||||
[
|
||||
.. Net80.References.All,
|
||||
MetadataReference.CreateFromFile(typeof(Core::ComputeSharp.Hlsl).Assembly.Location),
|
||||
MetadataReference.CreateFromFile(typeof(D3D12::ComputeSharp.IComputeShader).Assembly.Location)
|
||||
];
|
||||
|
||||
// Parse the source text (C# 11)
|
||||
SyntaxTree sourceTree = CSharpSyntaxTree.ParseText(
|
||||
@@ -1466,8 +1459,5 @@ public class DiagnosticsTests
|
||||
|
||||
Assert.IsTrue(outputCompilationDiagnostics.Count == 0, $"resultingIds: {string.Join(", ", outputCompilationDiagnostics)}");
|
||||
}
|
||||
|
||||
GC.KeepAlive(hlslType);
|
||||
GC.KeepAlive(computeShaderType);
|
||||
}
|
||||
}
|
||||
@@ -29,17 +29,17 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
}
|
||||
else if (methodInfo.GetCustomAttributes<DeviceAttribute>().ToArray() is { Length: > 0 } values)
|
||||
{
|
||||
devices = values.Select(static value => value.Device).ToArray();
|
||||
devices = [.. values.Select(static value => value.Device)];
|
||||
}
|
||||
else
|
||||
{
|
||||
devices = [];
|
||||
}
|
||||
|
||||
Type[] resources = methodInfo.GetCustomAttributes<ResourceAttribute>().Select(static value => value.Type).ToArray();
|
||||
Type[] additionalResources = methodInfo.GetCustomAttributes<AdditionalResourceAttribute>().Select(static value => value.Type).ToArray();
|
||||
object[][] data = methodInfo.GetCustomAttributes<DataAttribute>().Select(static value => value.Data).ToArray();
|
||||
object[][] additionalData = methodInfo.GetCustomAttributes<AdditionalDataAttribute>().Select(static value => value.Data).ToArray();
|
||||
Type[] resources = [.. methodInfo.GetCustomAttributes<ResourceAttribute>().Select(static value => value.Type)];
|
||||
Type[] additionalResources = [.. methodInfo.GetCustomAttributes<AdditionalResourceAttribute>().Select(static value => value.Type)];
|
||||
object[][] data = [.. methodInfo.GetCustomAttributes<DataAttribute>().Select(static value => value.Data)];
|
||||
object[][] additionalData = [.. methodInfo.GetCustomAttributes<AdditionalDataAttribute>().Select(static value => value.Data)];
|
||||
|
||||
if (devices.Length > 0)
|
||||
{
|
||||
@@ -60,7 +60,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
Assert.Fail("Invalid usage of [AdditionalData]");
|
||||
}
|
||||
|
||||
yield return new object[] { device, type, additionalType };
|
||||
yield return [device, type, additionalType];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -70,7 +70,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
{
|
||||
foreach (object[] additionalItems in additionalData)
|
||||
{
|
||||
yield return new object[] { device, type, additionalType }.Concat(items).Concat(additionalItems).ToArray();
|
||||
yield return [device, type, additionalType, .. items, .. additionalItems];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
{
|
||||
foreach (object[] items in data)
|
||||
{
|
||||
yield return new object[] { device, type, additionalType }.Concat(items).ToArray();
|
||||
yield return [device, type, additionalType, .. items];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
Assert.Fail("Invalid usage of [AdditionalData]");
|
||||
}
|
||||
|
||||
yield return new object[] { device, type };
|
||||
yield return [device, type];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -103,7 +103,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
{
|
||||
foreach (object[] additionalItems in additionalData)
|
||||
{
|
||||
yield return new object[] { device, type }.Concat(items).Concat(additionalItems).ToArray();
|
||||
yield return [device, type, .. items, .. additionalItems];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
{
|
||||
foreach (object[] items in data)
|
||||
{
|
||||
yield return new object[] { device, type }.Concat(items).ToArray();
|
||||
yield return [device, type, .. items];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
Assert.Fail("Invalid usage of [AdditionalData]");
|
||||
}
|
||||
|
||||
yield return new object[] { device };
|
||||
yield return [device];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -142,7 +142,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
{
|
||||
foreach (object[] additionalItems in additionalData)
|
||||
{
|
||||
yield return new object[] { device }.Concat(items).Concat(additionalItems).ToArray();
|
||||
yield return [device, .. items, .. additionalItems];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
{
|
||||
foreach (object[] items in data)
|
||||
{
|
||||
yield return new object[] { device }.Concat(items).ToArray();
|
||||
yield return [device, .. items];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,7 +172,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
Assert.Fail("Invalid usage of [AdditionalData]");
|
||||
}
|
||||
|
||||
yield return new object[] { type, additionalType };
|
||||
yield return [type, additionalType];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -182,7 +182,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
{
|
||||
foreach (object[] additionalItems in additionalData)
|
||||
{
|
||||
yield return new object[] { type, additionalType }.Concat(items).Concat(additionalItems).ToArray();
|
||||
yield return [type, additionalType, .. items, .. additionalItems];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -190,7 +190,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
{
|
||||
foreach (object[] items in data)
|
||||
{
|
||||
yield return new object[] { type, additionalType }.Concat(items).ToArray();
|
||||
yield return [type, additionalType, .. items];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
Assert.Fail("Invalid usage of [AdditionalData]");
|
||||
}
|
||||
|
||||
yield return new object[] { type };
|
||||
yield return [type];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -215,7 +215,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
{
|
||||
foreach (object[] additionalItems in additionalData)
|
||||
{
|
||||
yield return new object[] { type }.Concat(items).Concat(additionalItems).ToArray();
|
||||
yield return [type, .. items, .. additionalItems];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -223,7 +223,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
{
|
||||
foreach (object[] items in data)
|
||||
{
|
||||
yield return new object[] { type }.Concat(items).ToArray();
|
||||
yield return [type, .. items];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -244,7 +244,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
Assert.Fail("Invalid usage of [AdditionalData]");
|
||||
}
|
||||
|
||||
yield return Array.Empty<object>();
|
||||
yield return [];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -254,7 +254,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes
|
||||
{
|
||||
foreach (object[] additionalItems in additionalData)
|
||||
{
|
||||
yield return items.Concat(additionalItems).ToArray();
|
||||
yield return [.. items, .. additionalItems];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする