Skip to content

Commit

Permalink
Fix WideStringLiteralStaticConstTest on LatestUnix
Browse files Browse the repository at this point in the history
  • Loading branch information
tannergooding committed Nov 19, 2023
1 parent b427ef7 commit 933c644
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,23 +158,25 @@ protected override Task WideStringLiteralConstTestImpl()
const wchar_t* MyConst2 = L""Test\0\\\r\n\t\"""";
const wchar_t* const MyConst3 = L""Test\0\\\r\n\t\"""";";

var expectedOutputContents = $@"namespace ClangSharp.Test
var expectedOutputContents = $@"using System;
namespace ClangSharp.Test
{{
public static partial class Methods
{{
[NativeTypeName(""const wchar_t[11]"")]
public static readonly uint[] MyConst1 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }};
public static ReadOnlySpan<uint> MyConst1 => [0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000];
[NativeTypeName(""const wchar_t *"")]
public static uint[] MyConst2 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }};
public static uint[] MyConst2 = [0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000];
[NativeTypeName(""const wchar_t *const"")]
public static readonly uint[] MyConst3 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }};
public static ReadOnlySpan<uint> MyConst3 => [0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000];
}}
}}
";

return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents);
}

protected override Task StringLiteralConstTestImpl()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,19 @@ protected override Task WideStringLiteralConstTestImpl()
<constant name=""MyConst1"" access=""public"">
<type primitive=""False"">ReadOnlySpan&lt;uint&gt;</type>
<value>
<code>new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }}</code>
<code>[0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000]</code>
</value>
</constant>
<field name=""MyConst2"" access=""public"">
<type primitive=""False"">uint[]</type>
<value>
<code>new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }}</code>
<code>[0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000]</code>
</value>
</field>
<constant name=""MyConst3"" access=""public"">
<type primitive=""False"">ReadOnlySpan&lt;uint&gt;</type>
<value>
<code>new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }}</code>
<code>[0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000]</code>
</value>
</constant>
</class>
Expand Down Expand Up @@ -272,19 +272,19 @@ protected override Task WideStringLiteralStaticConstTestImpl()
<constant name=""MyConst1"" access=""public"">
<type primitive=""False"">ReadOnlySpan&lt;uint&gt;</type>
<value>
<code>new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }}</code>
<code>[0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000]</code>
</value>
</constant>
<field name=""MyConst2"" access=""public"">
<type primitive=""False"">uint[]</type>
<value>
<code>new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }}</code>
<code>[0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000]</code>
</value>
</field>
<constant name=""MyConst3"" access=""public"">
<type primitive=""False"">ReadOnlySpan&lt;uint&gt;</type>
<value>
<code>new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }}</code>
<code>[0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000]</code>
</value>
</constant>
</class>
Expand Down

0 comments on commit 933c644

Please sign in to comment.