@@ -115,16 +115,16 @@ protected override Task NoInitializerTestImpl(string nativeType)
115
115
116
116
protected override Task Utf8StringLiteralMacroTestImpl ( )
117
117
{
118
- var inputContents = $@ "#define MyMacro1 ""Test""";
118
+ var inputContents = $@ "#define MyMacro1 ""Test\0\\\r\n\t\"" """;
119
119
120
120
var expectedOutputContents = $@ "using System;
121
121
122
122
namespace ClangSharp.Test
123
123
{{
124
124
public static partial class Methods
125
125
{{
126
- [NativeTypeName(""#define MyMacro1 \""Test\"""")]
127
- public static ReadOnlySpan<byte> MyMacro1 => new byte[] {{ 0x54, 0x65, 0x73, 0x74, 0x00 }};
126
+ [NativeTypeName(""#define MyMacro1 \""Test\0\\\r\n\t\""\ """")]
127
+ public static ReadOnlySpan<byte> MyMacro1 => new byte[] {{ 0x54, 0x65, 0x73, 0x74, 0x00, 0x5C, 0x0D, 0x0A, 0x09, 0x22, 0x00 }};
128
128
}}
129
129
}}
130
130
" ;
@@ -134,14 +134,14 @@ public static partial class Methods
134
134
135
135
protected override Task Utf16StringLiteralMacroTestImpl ( )
136
136
{
137
- var inputContents = $@ "#define MyMacro1 u""Test""";
137
+ var inputContents = $@ "#define MyMacro1 u""Test\0\\\r\n\t\"" """;
138
138
139
139
var expectedOutputContents = $@ "namespace ClangSharp.Test
140
140
{{
141
141
public static partial class Methods
142
142
{{
143
- [NativeTypeName(""#define MyMacro1 u\""Test\"""")]
144
- public const string MyMacro1 = ""Test"";
143
+ [NativeTypeName(""#define MyMacro1 u\""Test\0\\\r\n\t\""\ """")]
144
+ public const string MyMacro1 = ""Test\0\\\r\n\t\"" "";
145
145
}}
146
146
}}
147
147
" ;
@@ -151,22 +151,22 @@ public static partial class Methods
151
151
152
152
protected override Task WideStringLiteralConstTestImpl ( )
153
153
{
154
- var inputContents = $@ "const wchar_t MyConst1[] = L""Test"";
155
- const wchar_t* MyConst2 = L""Test"";
156
- const wchar_t* const MyConst3 = L""Test"";" ;
154
+ var inputContents = $@ "const wchar_t MyConst1[] = L""Test\0\\\r\n\t\"" "";
155
+ const wchar_t* MyConst2 = L""Test\0\\\r\n\t\"" "";
156
+ const wchar_t* const MyConst3 = L""Test\0\\\r\n\t\"" "";" ;
157
157
158
158
var expectedOutputContents = $@ "namespace ClangSharp.Test
159
159
{{
160
160
public static partial class Methods
161
161
{{
162
- [NativeTypeName(""const wchar_t[5 ]"")]
163
- public static readonly uint[] MyConst1 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000 }};
162
+ [NativeTypeName(""const wchar_t[11 ]"")]
163
+ public static readonly uint[] MyConst1 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }};
164
164
165
165
[NativeTypeName(""const wchar_t *"")]
166
- public static uint[] MyConst2 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000 }};
166
+ public static uint[] MyConst2 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }};
167
167
168
168
[NativeTypeName(""const wchar_t *const"")]
169
- public static readonly uint[] MyConst3 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000 }};
169
+ public static readonly uint[] MyConst3 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }};
170
170
}}
171
171
}}
172
172
" ;
@@ -176,24 +176,24 @@ public static partial class Methods
176
176
177
177
protected override Task StringLiteralConstTestImpl ( )
178
178
{
179
- var inputContents = $@ "const char MyConst1[] = ""Test"";
180
- const char* MyConst2 = ""Test"";
181
- const char* const MyConst3 = ""Test"";" ;
179
+ var inputContents = $@ "const char MyConst1[] = ""Test\0\\\r\n\t\"" "";
180
+ const char* MyConst2 = ""Test\0\\\r\n\t\"" "";
181
+ const char* const MyConst3 = ""Test\0\\\r\n\t\"" "";" ;
182
182
183
183
var expectedOutputContents = $@ "using System;
184
184
185
185
namespace ClangSharp.Test
186
186
{{
187
187
public static partial class Methods
188
188
{{
189
- [NativeTypeName(""const char[5 ]"")]
190
- public static ReadOnlySpan<byte> MyConst1 => new byte[] {{ 0x54, 0x65, 0x73, 0x74, 0x00 }};
189
+ [NativeTypeName(""const char[11 ]"")]
190
+ public static ReadOnlySpan<byte> MyConst1 => new byte[] {{ 0x54, 0x65, 0x73, 0x74, 0x00, 0x5C, 0x0D, 0x0A, 0x09, 0x22, 0x00 }};
191
191
192
192
[NativeTypeName(""const char *"")]
193
- public static byte[] MyConst2 = new byte[] {{ 0x54, 0x65, 0x73, 0x74, 0x00 }};
193
+ public static byte[] MyConst2 = new byte[] {{ 0x54, 0x65, 0x73, 0x74, 0x00, 0x5C, 0x0D, 0x0A, 0x09, 0x22, 0x00 }};
194
194
195
195
[NativeTypeName(""const char *const"")]
196
- public static ReadOnlySpan<byte> MyConst3 => new byte[] {{ 0x54, 0x65, 0x73, 0x74, 0x00 }};
196
+ public static ReadOnlySpan<byte> MyConst3 => new byte[] {{ 0x54, 0x65, 0x73, 0x74, 0x00, 0x5C, 0x0D, 0x0A, 0x09, 0x22, 0x00 }};
197
197
}}
198
198
}}
199
199
" ;
@@ -203,22 +203,22 @@ public static partial class Methods
203
203
204
204
protected override Task WideStringLiteralStaticConstTestImpl ( )
205
205
{
206
- var inputContents = $@ "static const wchar_t MyConst1[] = L""Test"";
207
- static const wchar_t* MyConst2 = L""Test"";
208
- static const wchar_t* const MyConst3 = L""Test"";" ;
206
+ var inputContents = $@ "static const wchar_t MyConst1[] = L""Test\0\\\r\n\t\"" "";
207
+ static const wchar_t* MyConst2 = L""Test\0\\\r\n\t\"" "";
208
+ static const wchar_t* const MyConst3 = L""Test\0\\\r\n\t\"" "";" ;
209
209
210
210
var expectedOutputContents = $@ "namespace ClangSharp.Test
211
211
{{
212
212
public static partial class Methods
213
213
{{
214
- [NativeTypeName(""const wchar_t[5 ]"")]
215
- public static readonly uint[] MyConst1 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000 }};
214
+ [NativeTypeName(""const wchar_t[11 ]"")]
215
+ public static readonly uint[] MyConst1 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }};
216
216
217
217
[NativeTypeName(""const wchar_t *"")]
218
- public static uint[] MyConst2 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000 }};
218
+ public static uint[] MyConst2 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }};
219
219
220
220
[NativeTypeName(""const wchar_t *const"")]
221
- public static readonly uint[] MyConst3 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000 }};
221
+ public static readonly uint[] MyConst3 = new uint[] {{ 0x00000054, 0x00000065, 0x00000073, 0x00000074, 0x00000000, 0x0000005C, 0x0000000D, 0x0000000A, 0x00000009, 0x00000022, 0x00000000 }};
222
222
}}
223
223
}}
224
224
" ;
@@ -228,24 +228,24 @@ public static partial class Methods
228
228
229
229
protected override Task StringLiteralStaticConstTestImpl ( )
230
230
{
231
- var inputContents = $@ "static const char MyConst1[] = ""Test"";
232
- static const char* MyConst2 = ""Test"";
233
- static const char* const MyConst3 = ""Test"";" ;
231
+ var inputContents = $@ "static const char MyConst1[] = ""Test\0\\\r\n\t\"" "";
232
+ static const char* MyConst2 = ""Test\0\\\r\n\t\"" "";
233
+ static const char* const MyConst3 = ""Test\0\\\r\n\t\"" "";" ;
234
234
235
235
var expectedOutputContents = $@ "using System;
236
236
237
237
namespace ClangSharp.Test
238
238
{{
239
239
public static partial class Methods
240
240
{{
241
- [NativeTypeName(""const char[5 ]"")]
242
- public static ReadOnlySpan<byte> MyConst1 => new byte[] {{ 0x54, 0x65, 0x73, 0x74, 0x00 }};
241
+ [NativeTypeName(""const char[11 ]"")]
242
+ public static ReadOnlySpan<byte> MyConst1 => new byte[] {{ 0x54, 0x65, 0x73, 0x74, 0x00, 0x5C, 0x0D, 0x0A, 0x09, 0x22, 0x00 }};
243
243
244
244
[NativeTypeName(""const char *"")]
245
- public static byte[] MyConst2 = new byte[] {{ 0x54, 0x65, 0x73, 0x74, 0x00 }};
245
+ public static byte[] MyConst2 = new byte[] {{ 0x54, 0x65, 0x73, 0x74, 0x00, 0x5C, 0x0D, 0x0A, 0x09, 0x22, 0x00 }};
246
246
247
247
[NativeTypeName(""const char *const"")]
248
- public static ReadOnlySpan<byte> MyConst3 => new byte[] {{ 0x54, 0x65, 0x73, 0x74, 0x00 }};
248
+ public static ReadOnlySpan<byte> MyConst3 => new byte[] {{ 0x54, 0x65, 0x73, 0x74, 0x00, 0x5C, 0x0D, 0x0A, 0x09, 0x22, 0x00 }};
249
249
}}
250
250
}}
251
251
" ;
0 commit comments