Browse Source

Add pretty tests for virtual, interface, and struct auto-properties

Virtual/override/sealed-override auto-properties, implicit and
explicit interface implementations, asymmetric accessor
accessibility, and auto-properties in structs were not covered.

Assisted-by: Claude:claude-fable-5:Claude Code
pull/3857/head
Siegfried Pammer 4 days ago committed by Siegfried Pammer
parent
commit
9c9892764d
  1. 36
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/AutoProperties.cs

36
ICSharpCode.Decompiler.Tests/TestCases/Pretty/AutoProperties.cs

@ -2,6 +2,12 @@ using System;
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{ {
internal class AsymmetricAccessibility
{
public int PrivateSetter { get; private set; }
public int ProtectedSetter { get; protected set; }
}
internal class AutoProperties internal class AutoProperties
{ {
#if CS110 #if CS110
@ -38,10 +44,40 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
#endif #endif
} }
} }
internal class AutoPropertiesBase
{
public virtual int VirtualProperty { get; set; }
public virtual int VirtualGetterOnly { get; }
}
internal class AutoPropertiesDerived : AutoPropertiesBase
{
public override int VirtualProperty { get; set; }
public sealed override int VirtualGetterOnly { get; }
}
internal class AutoPropertyExplicitImpl : IAutoProperty
{
int IAutoProperty.Property { get; set; }
}
internal class AutoPropertyImplicitImpl : IAutoProperty
{
public int Property { get; set; }
}
internal interface IAutoProperty
{
int Property { get; set; }
}
#if !NET70 #if !NET70
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
internal sealed class RequiredMemberAttribute : Attribute internal sealed class RequiredMemberAttribute : Attribute
{ {
} }
#endif #endif
internal struct StructAutoProperties
{
public int Property { get; set; }
public int GetterOnly { get; }
}
} }

Loading…
Cancel
Save