diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 67ac77ce..41be502e 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "CSharpier": { - "version": "1.4.0", + "version": "1.4.1", "commands": ["csharpier"] } } diff --git a/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.Tests/GeneratedExcludedStorageBoundaryTests.cs b/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.Tests/GeneratedExcludedStorageBoundaryTests.cs index 38b83edb..c976fd17 100644 --- a/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.Tests/GeneratedExcludedStorageBoundaryTests.cs +++ b/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.Tests/GeneratedExcludedStorageBoundaryTests.cs @@ -62,41 +62,40 @@ bool includeSerializedFields string context = $"accessibility={accessibility}, serialized={includeSerializedFields}"; CSharpParseOptions options = new(LanguageVersion.CSharp9); - string CreateFixedStorageSource(string attribute, string constructor) => - $$""" - using DxMessaging.Core.Attributes; - - {{attribute}} - public unsafe partial struct Packet - { - public readonly int Value; - {{fieldAttribute}} {{accessibility}} fixed byte _bytes[4]; - {{constructor}} + string CreateFixedStorageSource(string attribute, string constructor) => $$""" + using DxMessaging.Core.Attributes; - public int WriteAndRead() - { - fixed (byte* bytes = _bytes) - { - bytes[3] = 73; - return bytes[3]; - } - } - } + {{attribute}} + public unsafe partial struct Packet + { + public readonly int Value; + {{fieldAttribute}} {{accessibility}} fixed byte _bytes[4]; + {{constructor}} - public static class Probe + public int WriteAndRead() { - public static int[] Read() + fixed (byte* bytes = _bytes) { - Packet packet = new Packet(42); - return new[] { packet.Value, packet.WriteAndRead() - 73, 0 }; + bytes[3] = 73; + return bytes[3]; } } + } - namespace UnityEngine + public static class Probe + { + public static int[] Read() { - public sealed class SerializeField : System.Attribute { } + Packet packet = new Packet(42); + return new[] { packet.Value, packet.WriteAndRead() - 73, 0 }; } - """; + } + + namespace UnityEngine + { + public sealed class SerializeField : System.Attribute { } + } + """; AssertCallerExecutes( CreateCompilation( diff --git a/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.Tests/NullableOptionalDefaultTests.cs b/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.Tests/NullableOptionalDefaultTests.cs index cd587e49..715ac7b1 100644 --- a/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.Tests/NullableOptionalDefaultTests.cs +++ b/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.Tests/NullableOptionalDefaultTests.cs @@ -213,8 +213,7 @@ private static string Source( string fieldAttribute, string constructor, string consumer - ) => - $$""" + ) => $$""" {{(constructor.Length == 0 ? "using DxMessaging.Core.Attributes;" : "")}} public enum Choice { None, Other } public readonly struct Payload