From: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2019 22:30:59 +0000 (+0000) Subject: [master] Update dependencies from dotnet/coreclr (dotnet/corefx#41851) X-Git-Tag: submit/tizen/20210909.063632~11031^2~271 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6596cc31bfc7161b635e2627378e6f6698c42dc7;p=platform%2Fupstream%2Fdotnet%2Fruntime.git [master] Update dependencies from dotnet/coreclr (dotnet/corefx#41851) * Update dependencies from https://github.com/dotnet/coreclr build 20191016.3 - Microsoft.NET.Sdk.IL - 5.0.0-alpha1.19516.3 - Microsoft.NETCore.ILAsm - 5.0.0-alpha1.19516.3 - Microsoft.NETCore.Runtime.CoreCLR - 5.0.0-alpha1.19516.3 * Add unit tests for DecoderNLS Commit migrated from https://github.com/dotnet/corefx/commit/6eb32bf0faef55321f02b1502ddaeac6dc4a76f6 --- diff --git a/src/libraries/System.Text.Encoding/tests/Decoder/DecoderConvert2.cs b/src/libraries/System.Text.Encoding/tests/Decoder/DecoderConvert2.cs index 33e04fe..9d87dbb 100644 --- a/src/libraries/System.Text.Encoding/tests/Decoder/DecoderConvert2.cs +++ b/src/libraries/System.Text.Encoding/tests/Decoder/DecoderConvert2.cs @@ -165,7 +165,7 @@ namespace System.Text.Tests } Decoder decoder = Encoding.Unicode.GetDecoder(); - VerificationHelper(decoder, bytes, 0, bytes.Length, chars, 0, chars.Length, false, bytes.Length, chars.Length / 2, true, "006.1"); + VerificationHelper(decoder, bytes, 0, bytes.Length, chars, 0, chars.Length, false, bytes.Length, chars.Length / 2, false, "006.1"); decoder.Reset(); // There will be 1 byte left unconverted after previous statement, and set flush = false should left this 1 byte in the buffer. VerificationHelper(decoder, bytes, 0, bytes.Length, chars, 0, chars.Length, true, bytes.Length, chars.Length / 2 + 1, true, "006.2"); @@ -274,6 +274,29 @@ namespace System.Text.Tests decoder.Reset(); } + // PosTest11: Call Convert with UTF-8 data, testing that flushing performs proper replacement if needed + [Fact] + public void PosTest11() + { + byte[] bytes = new byte[] + { + 0xC4, 0xB3, // U+0133 LATIN SMALL LIGATURE IJ + 0xE2, 0x86, 0x98, // U+2198 SOUTH EAST ARROW + 0xF0, 0x9F, 0x8E, 0xAE, // U+1F3AE VIDEO GAME + 0xC2, // invalid sequence - no trailing byte + }; + char[] chars = new char[32]; + Decoder decoder = Encoding.UTF8.GetDecoder(); + + VerificationHelper(decoder, bytes, 0, 1, chars, 0, 10, false, 1, 0, false, "011.1"); // incomplete since still state in Decoder + VerificationHelper(decoder, bytes, 1, 2, chars, 0, 10, false, 2, 1, false, "011.2"); // incomplete since still state in Decoder + VerificationHelper(decoder, bytes, 3, 6, chars, 1, 1, false, 2, 1, false, "011.3"); // incomplete since not all bytes consumed + VerificationHelper(decoder, bytes, 5, 4, chars, 2, 10, false, 4, 2, true, "011.4"); // complete since all bytes consumed and no leftover state + VerificationHelper(decoder, bytes, 9, 1, chars, 4, 10, true, 1, 1, true, "011.5"); // complete since all bytes consumed and no leftover state + + Assert.Equal("\u0133\u2198\U0001F3AE\ufffd", new string(chars, 0, 5)); + } + private void VerificationHelper(Decoder decoder, byte[] bytes, int byteIndex, int byteCount,