Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5d3733b
Add Compliance tests for GB18030-2022
jozkee Jul 25, 2025
2d68cfc
Address feedback
jozkee Jul 28, 2025
570c9b4
Fix StringTests - remove ordinal comparison tests
jozkee Aug 6, 2025
e281e13
Change parameter ordering
jozkee Aug 6, 2025
b7af2dc
Add RegexTests
jozkee Aug 6, 2025
3fd1b0f
Add CharTests
jozkee Aug 8, 2025
bd9aeff
Merge branch 'main' of https://github.com/dotnet/runtime into complia…
jozkee Aug 8, 2025
c5bd64c
Add CharUnicodeInfoTests, more CharTests, and cleanup RegexTests
jozkee Aug 11, 2025
0b6baf1
Rename fields and properties
jozkee Aug 11, 2025
126ff40
Make adjustments for linux and netfx
jozkee Aug 11, 2025
ba384e5
Skip NetFramework at testclass level
jozkee Aug 11, 2025
9df15f5
Merge remote-tracking branch 'upstream/main' into compliance_gb18030
jozkee Jul 25, 2026
f119767
Fix Compliance.Tests build against current main
jozkee Jul 25, 2026
3d2bc38
Address Copilot review feedback
jozkee Jul 25, 2026
c7d7821
Embed GB18030 test data to fix WASM test runs
jozkee Jul 26, 2026
7d8d392
Address Copilot review feedback
jozkee Jul 26, 2026
aa37d99
reduce nesting to avoid MAX_PATH errors on netfx
jozkee Jul 26, 2026
f50bfb1
Skip GB18030 Console/String tests on platforms without GB18030 support
jozkee Jul 26, 2026
289af03
Restore libunwind README.md symlink
jozkee Jul 26, 2026
cce6f64
Decouple GB18030 test data parsing from newline conventions
jozkee Jul 26, 2026
915749a
Tolerate '0'/'U+3007' zh-CN collation equivalence on browser in Repla…
jozkee Jul 26, 2026
999b7a2
Throw when embedded test data stream cannot be fully read
jozkee Jul 26, 2026
a485dd7
Fix missing space in param
jozkee Jul 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions 2 src/libraries/Common/Common.Tests.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
<Folder Name="/gen/">
<Project Path="../System.Runtime.InteropServices/gen/DownlevelLibraryImportGenerator/DownlevelLibraryImportGenerator.csproj" />
<Project Path="../System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Microsoft.Interop.SourceGeneration.csproj" />
<Project Path="../System.Text.RegularExpressions/gen/System.Text.RegularExpressions.Generator.csproj" />
</Folder>
<Folder Name="/tests/">
<Project Path="tests/Common.Tests.csproj" />
<Project Path="tests/ComplianceTests/Compliance.Tests.csproj" />
<Project Path="tests/StreamConformanceTests/StreamConformanceTests.csproj" />
<Project Path="tests/TestUtilities/TestUtilities.csproj" />
</Folder>
Expand Down
56 changes: 56 additions & 0 deletions 56 src/libraries/Common/tests/ComplianceTests/Compliance.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkCurrent)</TargetFrameworks>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
<UnicodeUcdVersion>16.0</UnicodeUcdVersion>
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
<EnableAotAnalyzer>false</EnableAotAnalyzer>
</PropertyGroup>

<ItemGroup>
<Compile Include="GB18030\TestHelper.cs" />
<Compile Include="GB18030\Tests\CharTests.cs" />
<Compile Include="GB18030\Tests\CharUnicodeInfoTests.cs" />
<Compile Include="GB18030\Tests\ConsoleTests.cs" />
<Compile Include="GB18030\Tests\DirectoryInfoTests.cs" />
<Compile Include="GB18030\Tests\DirectoryTestBase.cs" />
<Compile Include="GB18030\Tests\DirectoryTests.cs" />
<Compile Include="GB18030\Tests\EncodingTests.cs" />
<Compile Include="GB18030\Tests\FileInfoTests.cs" />
<Compile Include="GB18030\Tests\FileTestBase.cs" />
<Compile Include="GB18030\Tests\FileTests.cs" />
<Compile Include="GB18030\Tests\RegexTests.cs" />
<Compile Include="GB18030\Tests\StringTests.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Text.RegularExpressions\tests\FunctionalTests\Regex.Tests.Common.cs" Link="System\Text\RegularExpressions\Tests\Regex.Tests.Common.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System.Globalization.Tests\System\Globalization\CharUnicodeInfoTestData.cs" Link="System\Globalization\Tests\CharUnicodeInfoTestData.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
<Compile Include="$(LibrariesProjectRoot)System.Text.RegularExpressions\tests\FunctionalTests\RegexGeneratorHelper.netcoreapp.cs" Link="System\Text\RegularExpressions\Tests\RegexGeneratorHelper.netcoreapp.cs" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(MicrosoftCodeAnalysisVersion)" PrivateAssets="all" />
Comment thread
jozkee marked this conversation as resolved.
<ProjectReference Include="$(LibrariesProjectRoot)System.Text.RegularExpressions\gen\System.Text.RegularExpressions.Generator.csproj" SetTargetFramework="TargetFramework=netstandard2.0" OutputItemType="Analyzer" ReferenceOutputAssembly="true" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\StringSyntaxAttribute.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Text.RegularExpressions\tests\FunctionalTests\RegexGeneratorHelper.netfx.cs" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Text.Encodings.Web\src\System.Text.Encodings.Web.csproj" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="GB18030\Level3+Amendment_Test_Data_for_Mid_to_High_Volume_cases.txt">
<LogicalName>Level3+Amendment_Test_Data_for_Mid_to_High_Volume_cases.txt</LogicalName>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Private.Runtime.UnicodeData" Version="$(SystemPrivateRuntimeUnicodeDataVersion)" ExcludeAssets="contentFiles" GeneratePathProperty="true" />
<EmbeddedResource Include="$(PkgSystem_Private_Runtime_UnicodeData)\contentFiles\any\any\$(UnicodeUcdVersion).0\ucd\UnicodeData.txt">
<Link>CharUnicodeInfo\UnicodeData.$(UnicodeUcdVersion).txt</Link>
<LogicalName>UnicodeData.txt</LogicalName>
</EmbeddedResource>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Short sample strings for inputs with length limitation:
�5�0���8�7G�9�0A�9�4D�4�6���8�5C�@�2�3�5�7�9�2�ښ7�6�4�2�5�9�J�9�69�9�7�W�5�7�4�8
�י8�0Q�5�2�9�6d�9�6�1�4�6�4C�F�9�0���5�8���9�9g�7�9�9�5�9�8C�4�9�O�5�0�2�2�x�5�8
���3�8c�9�0d�ҙ2�3�9�0��a�ܘ9�1�5�5�3�9�9�9�9�4�٘5�9�4�9G�7�9�S�5�1A�5�9�9�9�7�8
�3�9d�9�6�5�9�8�2�o�9�0C�9�8�9�7���6�5�ј5�0�9�0���P�5�2�9�5���5�0s�8�0�4�0�0�9
�9�1�M�5�45�9�0���2�9r�9�6��5�2�5�2�Ș5�1�I�9�1�9�4�ښ8�9�8�4�0�9�5�3�4�0a
A�5�9�9�0��r�8�1G�8�1�6�1�O�9�5���3�3�ς5�4�9�7�9�1�5�2�0�2�4�9�����8�0�0�0�5�2
�D�6�4���8�2�5�1�ׂ0�3N�9�4D�8�3�3�8�K�9�8�0�9��9�3���5�5�3�2�5�3�5�32�4�0�8�7
��Ѡ�1�4A�3�6�5�0�9�6D�@�1�76�5�4�1�4���R�9�2���9�9�4�9�8�9�0�4�5�4�7�0G�5�6�7�2
�S�5�8εP���1�5O�0�8���8�4v�9�0�3�0�4�6q�9�0�9�7�@�5�5�1�8�8�5�0�0�4�3���5�5�5�7
�5�6ط���1�3�9�50���0�2�3�9�9�9D�0�8�M�9�1�����1�7�5�8�7�0�9�1�0�7�5�2�5�8�4�0

Long sample strings for inputs with extended length limitation��
Group0:
�5�9�5�2�����1�4�9�1�@�O�9�9�5�88e�2�6�5�6�@���9�2�3�3�����4�8�9�0�9�8�9�9rP�5�7�5�5�9�6�0�7�ƪǪ�U1������U2�x�y�zU3�7�6�1�7�٨�9�7�9�1�9�2�9�5�5�7�5�2�5�9�5�8�4�2�7�0�5�8�9�66n

Group1:
�����1�4�4�60u�9�9�9�6A�9�3�9�9�H���D�E�G�2�6�2�1�����7�8�9�7i�5�7�5�8�5�3�5�7�4�8�9�3�9�28�5�7�5�8�9�2�9�5�9�7�J�O�9�7�9�8�9�6�9�7�0�7�0�5�5�9�5�0�4�2�4�4�4�5�4�6�7�6�7�7�7�8�7�9�9�2�9�8����U1����U2�@�A�BU3

Group2:
�������9�1�8�5�J���W�9�7�1�4�2�1�@���8�7�8�8�8�58A�3�0�3�7�3�0�8�9�9�6�8�1FOC�8�2�8�3�8�7�8�7�2�4�2�5�7�0�ã�5�9�5�0�9�9�9�0�0�5�0�6�0�1�0�2�0�5�Q�5�9�5�0�9�0�9�9�4�6�4�9�4�7�4�2�4�3�4�4�ƪǪ�U1������U2�x�y�zU3�5�1�5�2�9�6�9�3�9�3�9�6�9�6�8�0

Group3:
�8�7�3�0����D�Ňև刊�۬@�A���B�cz�1�5�1�9�2�0�9�6�9�1�9�8ao�5�9�5�9���і7�4�7�8�0�9�0�2�0�3�0�5�3�0�3�8�P�R�����9�1�9�7�5�1�5�2�8�0�7�0�4�6�4�7�4�8�4�9����U1������U2�`�a�bU3�8�6�8�7�8�3�8�3�8�4E9z�8�1�8�4�8�2�5�1�5�2�9�0�9�8�5�3�5�4C

Group4:
�5�8�5�0���������3�8�9�6�H�J�L�O50R�8�6�8�2�8�5�0�0�5�9�5�2�9�0�9�6�9�38U5�1�3�3�0�4�0�2�8�3�0�3�9�5�3�5�4�S���9�0�9�18U5�0�0�0�1�0�4�0�5�7�9�7�3�7�3����U1������U2�@�A�BU3�5�3�5�4�9�0�9�9�5�5�5�6�����Κ4�3�4�9�4�3�4�6�8�5�8�0�8�8�8�1�򆿇�

Group5:
���Q�F���9�6�8�6�5�5�5�6�4�5�4�6�4�78bبأؤإ�6�6�6�5b�9�6�9�3�9�8�B�D�F�G�6�0�6�0�8�9�8�0�9�3�8�4�0�5�0�6�0�7�0�8�5�5�5�6�5�3�2�5�šȘ5�5�5�7�5�7�5�8�9�0�9�0�9�7�9�9��������U1������U2������U3�3�5�3�6�M�����4�7�4�858b

Group6:
�5�1�9�9�0�0�5�5�5�1ثج�壘5�6�5�9�Ǧ��j�����X�8�0�8�1�9�0�9�70wL�5�2�6�8�9�1�9�3�9�4�5�4�5�5�5�6�5�8�2�3�2�9�9�0�9�8�8�5�8�6�8�7�8�8�8�9�0�1�0�2�0�0�0�3A�5�7�5�8�8�7�6�9�Ь��U1������U2�P�a�rU3�5�9�5�2�T���5�8�5�0g9�9�1�9�9�H�J�L�M�}

Group7:
�5�8�5�2�����嫘8�6�8�0pW5�2�2�1�0�0�3�4�1�����������6�4�8�6�8�5�8�4@pU�2�2�7�9�7�1�7�3���ã��J�N�9�3�9�4�9�8�4�0�4�9�4�1�R���R�M�]�5�1�5�2�0�3�0�3�0�4�0�8e�9�0�9�9�8�3�8�4�8�4�8�1�5�9�5�7�5�0�5�5�9�0�9�6�6�2�6�3�6�4�6�0�6�7�6�8�2�0�2�0�2�5����U1������U2�q�r�sU3

Group8:
�@�f���Y������˜4�1�3�5�5�7�5�6�8�9�8�3yG�0�3�0�2�0�8�0�7A�2�7�2�8�򣹣��ژ9�3�9�6�9�4�9�8y0R�0�2�0�3�0�1�0�2����������2�0�2�1�2�3�2�1�J�S�5�8�5�5�9�0�9�9�5�9�5�0���¯ï�U1����������U2����������U3�5�7�5�8�4�7�4�8�4�9y0R�6�2�6�2�6�1�6�2�6�6�8�8�8�9�9�3�9�2�9�3�9�5�9�3

Group9:
�������0�0�0�4�0�5Qa�O�L�MA3c�5�2�5�8�����������3�5�3�6�3�8�1�7�8�4�9�0�9�3�9�4�9�8V9�4�3�4�6�4�7�R���0�8�0�6�0�7�0�8�9�0�9�1�6�3�6�7�6�5�7�4�7�6�ئ¨��5�5�5�1�9�0�9�9�9�8�9�9�9�4�7�8�6�9�8�0�9�6m0�9�5�9�1�5�1�5�2�2�9�1�7����U1������U2������U3�5�9�5�0

Group10:
�5�0�5�1���������2�4�5�4�Z�w���N���2�2�1�2�1�7a4�1�9�0�9�0�9�9�6�9�1�9�4�9�8�7�9�7�0�7�3�7�1��Ǩ��1�0�9�8�8�5�9�6�8�2�5�5�5�8�5�8�5�0�4�1�4�2�4�4�J���5�3�5�5�0�3�0�4�0�5�0�4�0�7���������F�1�2�1�3�1�4�1�5�1�6�1�7�7�6�7�7�7�8�7�9�7�0�9�1�9�2�ɮʮ�U1��������U2�u�v�wU3iv
202 changes: 202 additions & 0 deletions 202 src/libraries/Common/tests/ComplianceTests/GB18030/TestHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
Comment thread
jozkee marked this conversation as resolved.
using System.Collections.Generic;
using System.Globalization;
using System.Globalization.Tests;
using System.IO;
using System.Linq;
using System.Text;
using Xunit;

namespace GB18030.Tests;

public static class TestHelper
{
// New Code Points in existing ranges
internal static IEnumerable<int> CjkNewCodePoints { get; } = CreateRange(0x9FF0, 0x9FFF);
internal static IEnumerable<int> CjkExtensionANewCodePoints { get; } = CreateRange(0x4DB6, 0x4DBF);
internal static IEnumerable<int> CjkExtensionBNewCodePoints { get; } = CreateRange(0x2A6D7, 0x2A6DF);
internal static IEnumerable<int> CjkExtensionCNewCodePoints { get; } = CreateRange(0x2B735, 0x2B739);

// New ranges
internal static IEnumerable<int> CjkExtensionG { get; } = CreateRange(0x30000, 0x3134A);
internal static IEnumerable<int> CjkExtensionH { get; } = CreateRange(0x31350, 0x323AF);
internal static IEnumerable<int> CjkExtensionI { get; } = CreateRange(0x2EBF0, 0x2EE5D);

private static IEnumerable<int> CreateRange(int first, int last) => Enumerable.Range(first, last - first + 1);

private static IEnumerable<CharUnicodeInfoTestCase> s_gb18030CharUnicodeInfo { get; } = GetGB18030CharUnicodeInfo();
private static IEnumerable<CharUnicodeInfoTestCase> GetGB18030CharUnicodeInfo()
{
const int CodePointsTotal = 9793; // Make sure a Unicode version downgrade doesn't make us lose coverage.
Comment thread
jozkee marked this conversation as resolved.

var ret = CharUnicodeInfoTestData.TestCases.Where(tc => IsInGB18030Range(tc.CodePoint)).ToArray();
Assert.Equal(CodePointsTotal, ret.Length);
return ret;

static bool IsInGB18030Range(int codePoint)
=> (codePoint >= 0x9FF0 && codePoint <= 0x9FFF) ||
(codePoint >= 0x4DB6 && codePoint <= 0x4DBF) ||
(codePoint >= 0x2A6D7 && codePoint <= 0x2A6DF) ||
(codePoint >= 0x2B735 && codePoint <= 0x2B739) ||
(codePoint >= 0x30000 && codePoint <= 0x3134A) ||
(codePoint >= 0x31350 && codePoint <= 0x323AF) ||
(codePoint >= 0x2EBF0 && codePoint <= 0x2EE5D);
}

internal static CultureInfo[] Cultures { get; } = [
CultureInfo.CurrentCulture,
CultureInfo.InvariantCulture,
new CultureInfo("zh-CN")];

internal static CompareOptions[] CompareOptions { get; } = [
System.Globalization.CompareOptions.None,
System.Globalization.CompareOptions.IgnoreCase];

internal static StringComparison[] NonOrdinalStringComparisons { get; } = [
StringComparison.CurrentCulture,
StringComparison.CurrentCultureIgnoreCase,
StringComparison.InvariantCulture,
StringComparison.InvariantCultureIgnoreCase];

// Detects whether the current platform has up-to-date GB18030 support. Some older
// platforms (e.g. Windows Nano Server) lack it: they don't carry collation weights for
// the GB18030-2022 code points and can't set the GB18030 console code page. On such
// platforms U+4DBC (a CJK Extension A code point that GB18030-2022 covers) is treated as
// ignorable in linguistic comparisons, so IndexOf finds it at index 0 instead of -1.
public static bool IsGB18030Supported { get; } =
"abc".IndexOf("\u4DBC", StringComparison.InvariantCulture) < 0;

internal static string TestDataResourceName { get; } = "Level3+Amendment_Test_Data_for_Mid_to_High_Volume_cases.txt";

internal static byte[] TestDataFileBytes { get; } = ReadTestDataFileBytes();

private static byte[] ReadTestDataFileBytes()
{
using Stream stream = typeof(TestHelper).Assembly.GetManifestResourceStream(TestDataResourceName)
?? throw new InvalidOperationException($"Could not find embedded resource '{TestDataResourceName}'.");

// The manifest resource stream is seekable and reports the exact resource size, so read the
// whole thing into a right-sized buffer instead of growing a MemoryStream.
byte[] bytes = new byte[stream.Length];
int totalRead = 0;
while (totalRead < bytes.Length)
{
int read = stream.Read(bytes, totalRead, bytes.Length - totalRead);
if (read == 0)
throw new EndOfStreamException($"Expected {bytes.Length} bytes from '{TestDataResourceName}' but only read {totalRead}.");
totalRead += read;
}

// The data file is checked in as LF, but 'text=auto' materializes it as CRLF on Windows
// checkouts and it is then embedded verbatim, so the embedded bytes depend on the build OS.
// This broke the WASM legs: built on Windows (CRLF) but run on mono/WASM where the parser's
// LF record delimiters weren't found, throwing from the static constructor and failing every
// test. Normalize to LF so the data is identical regardless of build/run OS. Dropping every
// 0x0D is safe: it can only be a CR, as it never appears inside a multi-byte GB18030 sequence.
return bytes.Where(b => b != (byte)'\r').ToArray();
}

private static Encoding? s_gb18030Encoding;
internal static Encoding GB18030Encoding
{
get
{
if (s_gb18030Encoding is null)
{
#if !NETFRAMEWORK
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
#endif
Comment thread
jozkee marked this conversation as resolved.
s_gb18030Encoding = Encoding.GetEncoding("gb18030");
}

return s_gb18030Encoding;
}
}

private static readonly IEnumerable<byte[]> s_encodedTestData = GetTestData().ToArray();

internal static IEnumerable<string> DecodedTestData { get; } = s_encodedTestData.Select(data => GB18030Encoding.GetString(data)).ToArray();

private static readonly IEnumerable<string> s_splitNewLineDecodedTestData = DecodedTestData.SelectMany(
data => data.Split(['\n'], StringSplitOptions.RemoveEmptyEntries)).ToArray();

internal static IEnumerable<string> NonExceedingPathNameMaxDecodedTestData { get; } =
s_splitNewLineDecodedTestData.SelectMany<string, string>(
(data) =>
{
const int MaxPathSegmentName = 128;
Encoding fileSystemEncoding = PlatformDetection.IsWindows ? Encoding.Unicode : Encoding.UTF8;

if (fileSystemEncoding.GetByteCount(data) <= MaxPathSegmentName)
return [data];

List<string> result = new();
string current = string.Empty;
foreach (string element in GetTextElements(data))
{
if (fileSystemEncoding.GetByteCount(current) > MaxPathSegmentName)
{
result.Add(current);
current = string.Empty;
}
current += element;
}
result.Add(current);
return result;
}).ToArray();

public static IEnumerable<object[]> EncodedMemberData { get; } = s_encodedTestData.Select(data => new object[] { data }).ToArray();
public static IEnumerable<object[]> DecodedMemberData { get; } = DecodedTestData.Select(data => new object[] { data }).ToArray();
public static IEnumerable<object[]> NonExceedingPathNameMaxDecodedMemberData { get; } = NonExceedingPathNameMaxDecodedTestData.Select(data => new object[] { data }).ToArray();
public static IEnumerable<object[]> GB18030CharUnicodeInfoMemberData { get; } = s_gb18030CharUnicodeInfo.Select(data => new object[] { data }).ToArray();

private static IEnumerable<byte[]> GetTestData()
{
// The test data uses LF as its record separator (see ReadTestDataFileBytes, which normalizes
// the embedded resource to LF). Parse against '\n' explicitly so the record boundaries never
// depend on Environment.NewLine, which varies by runtime (LF on Unix/WASM, CRLF on Windows).
byte[] startDelimiter = GB18030Encoding.GetBytes(":\n");
byte[] endDelimiter = GB18030Encoding.GetBytes("\n\n");

// Instead of inlining the data in source, parse the test data from an embedded resource to prevent encoding issues.
ReadOnlyMemory<byte> testFileBytes = TestDataFileBytes;

while (testFileBytes.Length > 0)
{
int start = testFileBytes.Span.IndexOf(startDelimiter);
Comment thread
jozkee marked this conversation as resolved.
if (start == -1)
{
// Every record is introduced by its start delimiter, so anything left here means the
// data file was modified unexpectedly. Fail loudly rather than silently running fewer cases.
throw new InvalidDataException($"Unexpected trailing content in '{TestDataResourceName}'; expected a '{{label}}:' record delimiter.");
}

testFileBytes = testFileBytes.Slice(start + startDelimiter.Length);

int end = testFileBytes.Span.IndexOf(endDelimiter);
if (end == -1)
end = testFileBytes.Length;

yield return testFileBytes.Slice(0, end).ToArray();

testFileBytes = testFileBytes.Slice(end);
}

// Add a few additional test cases to exercise test correctness.
yield return GB18030Encoding.GetBytes("aaa");
yield return GB18030Encoding.GetBytes("abc");
yield return GB18030Encoding.GetBytes("𫓧𫓧");
}

internal static IEnumerable<string> GetTextElements(string input)
{
TextElementEnumerator enumerator = StringInfo.GetTextElementEnumerator(input);
while (enumerator.MoveNext())
{
yield return enumerator.GetTextElement();
}
}
}
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.