Browse Source

Add pretty tests for readonly record structs and custom record members

readonly record struct had no coverage, and no record overrode a
synthesized member; user-declared ToString and PrintMembers pin the
synthesized-vs-user member detection.

Assisted-by: Claude:claude-fable-5:Claude Code
pull/3857/head
Siegfried Pammer 3 days ago committed by Siegfried Pammer
parent
commit
bb78c2d1ea
  1. 23
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Records.cs

23
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Records.cs

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
using System;
#if CS100
using System.Runtime.InteropServices;
using System.Text;
#endif
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
@ -247,6 +248,8 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -247,6 +248,8 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
#if CS100
internal class RecordStructs
{
public readonly record struct ReadonlyPoint(int X, int Y);
public record struct Base(string A);
public record CopyCtor(string A)
@ -445,5 +448,25 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -445,5 +448,25 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
}
}
internal class RecordsWithCustomSynthesizedMembers
{
public record WithCustomToString(int A)
{
public sealed override string ToString()
{
return "custom";
}
}
public record WithCustomPrintMembers(int A)
{
protected virtual bool PrintMembers(StringBuilder builder)
{
builder.Append("X");
return true;
}
}
}
#endif
}

Loading…
Cancel
Save