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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <auto-generated/>
// <auto-generated/>
#pragma warning disable

// <auto-generated/>
Expand All @@ -9,13 +9,13 @@ internal sealed class ClassTupleDataSourceDrivenTests_DataSource_TupleMethod_Tes
{
#if NET8_0_OR_GREATER
[global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "<Property1>k__BackingField")]
private static extern ref (int, string, bool) GetProperty1BackingField(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests instance);
private static extern ref global::System.ValueTuple<int, string, bool> GetProperty1BackingField(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests instance);
[global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "<Property2>k__BackingField")]
private static extern ref (int, string, bool) GetProperty2BackingField(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests instance);
private static extern ref global::System.ValueTuple<int, string, bool> GetProperty2BackingField(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests instance);
[global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "<Property3>k__BackingField")]
private static extern ref (int Number, string Word, bool Flag) GetProperty3BackingField(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests instance);
private static extern ref global::System.ValueTuple<int, string, bool> GetProperty3BackingField(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests instance);
[global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "<Property4>k__BackingField")]
private static extern ref (int Number, string Word, bool Flag) GetProperty4BackingField(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests instance);
private static extern ref global::System.ValueTuple<int, string, bool> GetProperty4BackingField(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests instance);
#endif
public async global::System.Threading.Tasks.ValueTask<global::System.Collections.Generic.List<global::TUnit.Core.TestMetadata>> GetTestsAsync(string testSessionId)
{
Expand Down Expand Up @@ -94,7 +94,7 @@ internal sealed class ClassTupleDataSourceDrivenTests_DataSource_TupleMethod_Tes
new global::TUnit.Core.PropertyDataSource
{
PropertyName = "Property1",
PropertyType = typeof((int, string, bool)),
PropertyType = typeof(global::System.ValueTuple<int, string, bool>),
DataSource = new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod")
{
Factory = (dataGeneratorMetadata) =>
Expand All @@ -111,7 +111,7 @@ internal sealed class ClassTupleDataSourceDrivenTests_DataSource_TupleMethod_Tes
new global::TUnit.Core.PropertyDataSource
{
PropertyName = "Property2",
PropertyType = typeof((int, string, bool)),
PropertyType = typeof(global::System.ValueTuple<int, string, bool>),
DataSource = new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod")
{
Factory = (dataGeneratorMetadata) =>
Expand All @@ -128,7 +128,7 @@ internal sealed class ClassTupleDataSourceDrivenTests_DataSource_TupleMethod_Tes
new global::TUnit.Core.PropertyDataSource
{
PropertyName = "Property3",
PropertyType = typeof((int Number, string Word, bool Flag)),
PropertyType = typeof(global::System.ValueTuple<int, string, bool>),
DataSource = new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod")
{
Factory = (dataGeneratorMetadata) =>
Expand All @@ -145,7 +145,7 @@ internal sealed class ClassTupleDataSourceDrivenTests_DataSource_TupleMethod_Tes
new global::TUnit.Core.PropertyDataSource
{
PropertyName = "Property4",
PropertyType = typeof((int Number, string Word, bool Flag)),
PropertyType = typeof(global::System.ValueTuple<int, string, bool>),
DataSource = new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod")
{
Factory = (dataGeneratorMetadata) =>
Expand All @@ -165,9 +165,9 @@ internal sealed class ClassTupleDataSourceDrivenTests_DataSource_TupleMethod_Tes
new global::TUnit.Core.PropertyInjectionData
{
PropertyName = "Property1",
PropertyType = typeof((int, string, bool)),
PropertyType = typeof(global::System.ValueTuple<int, string, bool>),
#if NET8_0_OR_GREATER
Setter = (instance, value) => GetProperty1BackingField((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance) = ((int, string, bool))value,
Setter = (instance, value) => GetProperty1BackingField((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance) = (global::System.ValueTuple<int, string, bool>)value,
#else
Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"),
#endif
Expand All @@ -183,9 +183,9 @@ internal sealed class ClassTupleDataSourceDrivenTests_DataSource_TupleMethod_Tes
new global::TUnit.Core.PropertyInjectionData
{
PropertyName = "Property2",
PropertyType = typeof((int, string, bool)),
PropertyType = typeof(global::System.ValueTuple<int, string, bool>),
#if NET8_0_OR_GREATER
Setter = (instance, value) => GetProperty2BackingField((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance) = ((int, string, bool))value,
Setter = (instance, value) => GetProperty2BackingField((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance) = (global::System.ValueTuple<int, string, bool>)value,
#else
Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"),
#endif
Expand All @@ -201,9 +201,9 @@ internal sealed class ClassTupleDataSourceDrivenTests_DataSource_TupleMethod_Tes
new global::TUnit.Core.PropertyInjectionData
{
PropertyName = "Property3",
PropertyType = typeof((int Number, string Word, bool Flag)),
PropertyType = typeof(global::System.ValueTuple<int, string, bool>),
#if NET8_0_OR_GREATER
Setter = (instance, value) => GetProperty3BackingField((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance) = ((int Number, string Word, bool Flag))value,
Setter = (instance, value) => GetProperty3BackingField((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance) = (global::System.ValueTuple<int, string, bool>)value,
#else
Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"),
#endif
Expand All @@ -219,9 +219,9 @@ internal sealed class ClassTupleDataSourceDrivenTests_DataSource_TupleMethod_Tes
new global::TUnit.Core.PropertyInjectionData
{
PropertyName = "Property4",
PropertyType = typeof((int Number, string Word, bool Flag)),
PropertyType = typeof(global::System.ValueTuple<int, string, bool>),
#if NET8_0_OR_GREATER
Setter = (instance, value) => GetProperty4BackingField((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance) = ((int Number, string Word, bool Flag))value,
Setter = (instance, value) => GetProperty4BackingField((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance) = (global::System.ValueTuple<int, string, bool>)value,
#else
Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"),
#endif
Expand Down Expand Up @@ -317,7 +317,7 @@ internal sealed class ClassTupleDataSourceDrivenTests_DataSource_TupleMethod_Tes
new global::TUnit.Core.PropertyMetadata
{
ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetProperty("Property1"),
Type = typeof((int, string, bool)),
Type = typeof(global::System.ValueTuple<int, string, bool>),
Name = "Property1",
IsStatic = false,
IsNullable = false,
Expand All @@ -328,7 +328,7 @@ internal sealed class ClassTupleDataSourceDrivenTests_DataSource_TupleMethod_Tes
new global::TUnit.Core.PropertyMetadata
{
ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetProperty("Property2"),
Type = typeof((int, string, bool)),
Type = typeof(global::System.ValueTuple<int, string, bool>),
Name = "Property2",
IsStatic = false,
IsNullable = false,
Expand All @@ -339,7 +339,7 @@ internal sealed class ClassTupleDataSourceDrivenTests_DataSource_TupleMethod_Tes
new global::TUnit.Core.PropertyMetadata
{
ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetProperty("Property3"),
Type = typeof((int Number, string Word, bool Flag)),
Type = typeof(global::System.ValueTuple<int, string, bool>),
Name = "Property3",
IsStatic = false,
IsNullable = false,
Expand All @@ -350,7 +350,7 @@ internal sealed class ClassTupleDataSourceDrivenTests_DataSource_TupleMethod_Tes
new global::TUnit.Core.PropertyMetadata
{
ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetProperty("Property4"),
Type = typeof((int Number, string Word, bool Flag)),
Type = typeof(global::System.ValueTuple<int, string, bool>),
Name = "Property4",
IsStatic = false,
IsNullable = false,
Expand All @@ -374,10 +374,10 @@ internal sealed class ClassTupleDataSourceDrivenTests_DataSource_TupleMethod_Tes
{
return new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(TUnit.Core.Helpers.CastHelper.Cast<int>(args[0]), TUnit.Core.Helpers.CastHelper.Cast<string>(args[1]), TUnit.Core.Helpers.CastHelper.Cast<bool>(args[2]))
{
Property1 = default((int, string, bool)),
Property2 = default((int, string, bool)),
Property3 = default((int Number, string Word, bool Flag)),
Property4 = default((int Number, string Word, bool Flag)),
Property1 = default(global::System.ValueTuple<int, string, bool>),
Property2 = default(global::System.ValueTuple<int, string, bool>),
Property3 = default(global::System.ValueTuple<int, string, bool>),
Property4 = default(global::System.ValueTuple<int, string, bool>),
};
},
TestInvoker = async (instance, args) =>
Expand Down
17 changes: 16 additions & 1 deletion TUnit.Core.SourceGenerator/DisplayFormats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public class DisplayFormats
SymbolDisplayPropertyStyle.NameOnly,
SymbolDisplayLocalOptions.IncludeType,
miscellaneousOptions: SymbolDisplayMiscellaneousOptions.UseSpecialTypes
#if ROSLYN4_7_OR_GREATER
| SymbolDisplayMiscellaneousOptions.ExpandValueTuple
#endif
);

public static readonly SymbolDisplayFormat FullyQualifiedGenericWithGlobalPrefix = new(
Expand All @@ -28,6 +31,9 @@ public class DisplayFormats
SymbolDisplayPropertyStyle.NameOnly,
SymbolDisplayLocalOptions.IncludeType,
miscellaneousOptions: SymbolDisplayMiscellaneousOptions.UseSpecialTypes
#if ROSLYN4_7_OR_GREATER
| SymbolDisplayMiscellaneousOptions.ExpandValueTuple
#endif
);

public static readonly SymbolDisplayFormat FullyQualifiedNonGeneric = new(
Expand All @@ -41,6 +47,9 @@ public class DisplayFormats
SymbolDisplayPropertyStyle.NameOnly,
SymbolDisplayLocalOptions.IncludeType,
miscellaneousOptions: SymbolDisplayMiscellaneousOptions.UseSpecialTypes
#if ROSLYN4_7_OR_GREATER
| SymbolDisplayMiscellaneousOptions.ExpandValueTuple
#endif
);

public static readonly SymbolDisplayFormat FullyQualifiedGenericWithoutGlobalPrefix = new(
Expand All @@ -54,10 +63,13 @@ public class DisplayFormats
SymbolDisplayPropertyStyle.NameOnly,
SymbolDisplayLocalOptions.IncludeType,
miscellaneousOptions: SymbolDisplayMiscellaneousOptions.UseSpecialTypes
#if ROSLYN4_7_OR_GREATER
| SymbolDisplayMiscellaneousOptions.ExpandValueTuple
#endif
);

public static readonly SymbolDisplayFormat NameOnly = new(miscellaneousOptions: SymbolDisplayMiscellaneousOptions.UseSpecialTypes);

public static readonly SymbolDisplayFormat FullyQualifiedGenericTypeOnly = new(
SymbolDisplayGlobalNamespaceStyle.Included,
SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
Expand All @@ -69,5 +81,8 @@ public class DisplayFormats
SymbolDisplayPropertyStyle.NameOnly,
SymbolDisplayLocalOptions.None,
miscellaneousOptions: SymbolDisplayMiscellaneousOptions.UseSpecialTypes
#if ROSLYN4_7_OR_GREATER
| SymbolDisplayMiscellaneousOptions.ExpandValueTuple
#endif
);
}
17 changes: 17 additions & 0 deletions TUnit.TestProject/Bugs/2798/Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace TUnit.TestProject.Bugs._2798;

public record Foo
{
public static implicit operator Foo((int Value1, int Value2) tuple) => new();
}

public class Tests
{
[Test]
[MethodDataSource(nameof(Data))]
public void Test1(Foo data)
{
}

public static IEnumerable<Foo> Data() => [new()];
}
Loading