Skip to content

Commit 933c644

Browse files
committed
Fix WideStringLiteralStaticConstTest on LatestUnix
1 parent b427ef7 commit 933c644

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/VarDeclarationTest.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,23 +158,25 @@ protected override Task WideStringLiteralConstTestImpl()
158158
const wchar_t* MyConst2 = L""Test\0\\\r\n\t\"""";
159159
const wchar_t* const MyConst3 = L""Test\0\\\r\n\t\"""";";
160160

161-
var expectedOutputContents = $@"namespace ClangSharp.Test
161+
var expectedOutputContents = $@"using System;
162+
163+
namespace ClangSharp.Test
162164
{{
163165
public static partial class Methods
164166
{{
165167
[NativeTypeName(""const wchar_t[11]"")]
166-
public static readonly uint[] MyConst1 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }};
168+
public static ReadOnlySpan<uint> MyConst1 => [0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000];
167169
168170
[NativeTypeName(""const wchar_t *"")]
169-
public static uint[] MyConst2 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }};
171+
public static uint[] MyConst2 = [0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000];
170172
171173
[NativeTypeName(""const wchar_t *const"")]
172-
public static readonly uint[] MyConst3 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }};
174+
public static ReadOnlySpan<uint> MyConst3 => [0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000];
173175
}}
174176
}}
175177
";
176178

177-
return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
179+
return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents);
178180
}
179181

180182
protected override Task StringLiteralConstTestImpl()

tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/VarDeclarationTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,19 +200,19 @@ protected override Task WideStringLiteralConstTestImpl()
200200
<constant name=""MyConst1"" access=""public"">
201201
<type primitive=""False"">ReadOnlySpan&lt;uint&gt;</type>
202202
<value>
203-
<code>new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }}</code>
203+
<code>[0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000]</code>
204204
</value>
205205
</constant>
206206
<field name=""MyConst2"" access=""public"">
207207
<type primitive=""False"">uint[]</type>
208208
<value>
209-
<code>new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }}</code>
209+
<code>[0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000]</code>
210210
</value>
211211
</field>
212212
<constant name=""MyConst3"" access=""public"">
213213
<type primitive=""False"">ReadOnlySpan&lt;uint&gt;</type>
214214
<value>
215-
<code>new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }}</code>
215+
<code>[0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000]</code>
216216
</value>
217217
</constant>
218218
</class>
@@ -272,19 +272,19 @@ protected override Task WideStringLiteralStaticConstTestImpl()
272272
<constant name=""MyConst1"" access=""public"">
273273
<type primitive=""False"">ReadOnlySpan&lt;uint&gt;</type>
274274
<value>
275-
<code>new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }}</code>
275+
<code>[0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000]</code>
276276
</value>
277277
</constant>
278278
<field name=""MyConst2"" access=""public"">
279279
<type primitive=""False"">uint[]</type>
280280
<value>
281-
<code>new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }}</code>
281+
<code>[0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000]</code>
282282
</value>
283283
</field>
284284
<constant name=""MyConst3"" access=""public"">
285285
<type primitive=""False"">ReadOnlySpan&lt;uint&gt;</type>
286286
<value>
287-
<code>new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }}</code>
287+
<code>[0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000]</code>
288288
</value>
289289
</constant>
290290
</class>

0 commit comments

Comments
 (0)