You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
parent
e49d6f06c0
commit
536cd135cc
@@ -2,7 +2,8 @@
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>4.1.0.0</AssemblyVersion>
|
||||
<AssemblyVersion>4.1.1.0</AssemblyVersion>
|
||||
<AssemblyKey>MSFT</AssemblyKey>
|
||||
<IsNETCoreApp>true</IsNETCoreApp>
|
||||
<IsUAP>true</IsUAP>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
Compat issues with assembly System.Text.Encoding:
|
||||
MembersMustExist : Member 'System.Text.Decoder.Convert(System.Byte*, System.Int32, System.Char*, System.Int32, System.Boolean, System.Int32, System.Int32, System.Boolean)' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Text.Decoder.GetCharCount(System.Byte*, System.Int32, System.Boolean)' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Text.Decoder.GetChars(System.Byte*, System.Int32, System.Char*, System.Int32, System.Boolean)' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Text.Encoder.Convert(System.Char*, System.Int32, System.Byte*, System.Int32, System.Boolean, System.Int32, System.Int32, System.Boolean)' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Text.Encoder.GetBytes(System.Char*, System.Int32, System.Byte*, System.Int32, System.Boolean)' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Text.Encoding.BodyName.get()' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Text.Encoding.Default.get()' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Text.Encoding.GetEncodings()' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Text.Encoding.HeaderName.get()' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Text.Encoding.IsAlwaysNormalized()' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Text.Encoding.IsAlwaysNormalized(System.Text.NormalizationForm)' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Text.Encoding.IsBrowserDisplay.get()' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Text.Encoding.IsBrowserSave.get()' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Text.Encoding.IsMailNewsDisplay.get()' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Text.Encoding.IsMailNewsSave.get()' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Text.Encoding.WindowsCodePage.get()' does not exist in the implementation but it does exist in the contract.
|
||||
Total Issues: 16
|
||||
Total Issues: 8
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
|
||||
<ProjectGuid>{635F30B9-5566-4096-B772-68FAA9B00DF4}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<!-- Help VS understand available configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Unix-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Unix-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Debug|AnyCPU'" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
@@ -94,13 +94,13 @@ namespace System.Text.Encodings.Tests
|
||||
byte *pBytes = bytesPtr;
|
||||
char *pChars = charsPtr;
|
||||
|
||||
Assert.Throws<ArgumentNullException>("chars", () => decoder.Convert(pBytes, bytes.Length, null, 1, true, out bytesUsed, out charsUsed, out completed));
|
||||
Assert.Throws<ArgumentNullException>("bytes", () => decoder.Convert(null, bytes.Length, pChars, 1, true, out bytesUsed, out charsUsed, out completed));
|
||||
AssertExtensions.Throws<ArgumentNullException>("chars", () => decoder.Convert(pBytes, bytes.Length, null, 1, true, out bytesUsed, out charsUsed, out completed));
|
||||
AssertExtensions.Throws<ArgumentNullException>("bytes", () => decoder.Convert(null, bytes.Length, pChars, 1, true, out bytesUsed, out charsUsed, out completed));
|
||||
|
||||
Assert.Throws<ArgumentOutOfRangeException>("byteCount", () => decoder.Convert(pBytes, -1, pChars, 1, true, out bytesUsed, out charsUsed, out completed));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("charCount", () => decoder.Convert(pBytes, bytes.Length, pChars, -1, true, out bytesUsed, out charsUsed, out completed));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("byteCount", () => decoder.Convert(pBytes, -1, pChars, 1, true, out bytesUsed, out charsUsed, out completed));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("charCount", () => decoder.Convert(pBytes, bytes.Length, pChars, -1, true, out bytesUsed, out charsUsed, out completed));
|
||||
|
||||
Assert.Throws<ArgumentException>("chars", () => decoder.Convert(pBytes, bytes.Length, pChars, 0, true, out bytesUsed, out charsUsed, out completed));
|
||||
AssertExtensions.Throws<ArgumentException>("chars", () => decoder.Convert(pBytes, bytes.Length, pChars, 0, true, out bytesUsed, out charsUsed, out completed));
|
||||
}
|
||||
|
||||
decoder = Encoding.GetEncoding("us-ascii", new EncoderExceptionFallback(), new DecoderExceptionFallback()).GetDecoder();
|
||||
@@ -173,15 +173,15 @@ namespace System.Text.Encodings.Tests
|
||||
byte *pBytes = bytesPtr;
|
||||
char *pChars = charsPtr;
|
||||
|
||||
Assert.Throws<ArgumentNullException>("chars", () => decoder.GetChars(pBytes, bytes.Length, null, 1, true));
|
||||
Assert.Throws<ArgumentNullException>("bytes", () => decoder.GetChars(null, bytes.Length, pChars, 1, true));
|
||||
Assert.Throws<ArgumentNullException>("bytes", () => decoder.GetCharCount(null, bytes.Length, true));
|
||||
AssertExtensions.Throws<ArgumentNullException>("chars", () => decoder.GetChars(pBytes, bytes.Length, null, 1, true));
|
||||
AssertExtensions.Throws<ArgumentNullException>("bytes", () => decoder.GetChars(null, bytes.Length, pChars, 1, true));
|
||||
AssertExtensions.Throws<ArgumentNullException>("bytes", () => decoder.GetCharCount(null, bytes.Length, true));
|
||||
|
||||
Assert.Throws<ArgumentOutOfRangeException>("byteCount", () => decoder.GetChars(pBytes, -1, pChars, 1, true));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("charCount", () => decoder.GetChars(pBytes, bytes.Length, pChars, -1, true));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("count", () => decoder.GetCharCount(pBytes, -1, true));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("byteCount", () => decoder.GetChars(pBytes, -1, pChars, 1, true));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("charCount", () => decoder.GetChars(pBytes, bytes.Length, pChars, -1, true));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => decoder.GetCharCount(pBytes, -1, true));
|
||||
|
||||
Assert.Throws<ArgumentException>("chars", () => decoder.GetChars(pBytes, bytes.Length, pChars, 1, true));
|
||||
AssertExtensions.Throws<ArgumentException>("chars", () => decoder.GetChars(pBytes, bytes.Length, pChars, 1, true));
|
||||
}
|
||||
|
||||
decoder = Encoding.GetEncoding("us-ascii", new EncoderExceptionFallback(), new DecoderExceptionFallback()).GetDecoder();
|
||||
@@ -1,4 +1,4 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
@@ -91,13 +91,13 @@ namespace System.Text.Encodings.Tests
|
||||
byte *pBytes = bytesPtr;
|
||||
char *pChars = charsPtr;
|
||||
|
||||
Assert.Throws<ArgumentNullException>("chars", () => encoder.Convert(null, chars.Length, pBytes, bytes.Length, true, out charsUsed, out bytesUsed, out completed));
|
||||
Assert.Throws<ArgumentNullException>("bytes", () => encoder.Convert(pChars, chars.Length, null, bytes.Length, true, out charsUsed, out bytesUsed, out completed));
|
||||
AssertExtensions.Throws<ArgumentNullException>("chars", () => encoder.Convert(null, chars.Length, pBytes, bytes.Length, true, out charsUsed, out bytesUsed, out completed));
|
||||
AssertExtensions.Throws<ArgumentNullException>("bytes", () => encoder.Convert(pChars, chars.Length, null, bytes.Length, true, out charsUsed, out bytesUsed, out completed));
|
||||
|
||||
Assert.Throws<ArgumentOutOfRangeException>("byteCount", () => encoder.Convert(pChars, chars.Length, pBytes, -1, true, out charsUsed, out bytesUsed, out completed));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("charCount", () => encoder.Convert(pChars, -1, pBytes, bytes.Length, true, out charsUsed, out bytesUsed, out completed));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("byteCount", () => encoder.Convert(pChars, chars.Length, pBytes, -1, true, out charsUsed, out bytesUsed, out completed));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("charCount", () => encoder.Convert(pChars, -1, pBytes, bytes.Length, true, out charsUsed, out bytesUsed, out completed));
|
||||
|
||||
Assert.Throws<ArgumentException>("bytes", () => encoder.Convert(pChars, chars.Length, pBytes, 0, true, out charsUsed, out bytesUsed, out completed));
|
||||
AssertExtensions.Throws<ArgumentException>("bytes", () => encoder.Convert(pChars, chars.Length, pBytes, 0, true, out charsUsed, out bytesUsed, out completed));
|
||||
}
|
||||
|
||||
encoder = Encoding.GetEncoding("us-ascii", new EncoderExceptionFallback(), new DecoderExceptionFallback()).GetEncoder();
|
||||
@@ -166,15 +166,15 @@ namespace System.Text.Encodings.Tests
|
||||
byte *pBytes = bytesPtr;
|
||||
char *pChars = charsPtr;
|
||||
|
||||
Assert.Throws<ArgumentNullException>("bytes", () => encoder.GetBytes(pChars, s.Length, null, 1, true));
|
||||
Assert.Throws<ArgumentNullException>("chars", () => encoder.GetBytes(null, s.Length, pBytes, 4, true));
|
||||
Assert.Throws<ArgumentNullException>("chars", () => encoder.GetByteCount(null, s.Length, true));
|
||||
AssertExtensions.Throws<ArgumentNullException>("bytes", () => encoder.GetBytes(pChars, s.Length, null, 1, true));
|
||||
AssertExtensions.Throws<ArgumentNullException>("chars", () => encoder.GetBytes(null, s.Length, pBytes, 4, true));
|
||||
AssertExtensions.Throws<ArgumentNullException>("chars", () => encoder.GetByteCount(null, s.Length, true));
|
||||
|
||||
Assert.Throws<ArgumentOutOfRangeException>("charCount", () => encoder.GetBytes(pChars, -1, pBytes, 4, true));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("byteCount", () => encoder.GetBytes(pChars, s.Length, pBytes, -1, true));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("count", () => encoder.GetByteCount(pChars, -1, true));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("charCount", () => encoder.GetBytes(pChars, -1, pBytes, 4, true));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("byteCount", () => encoder.GetBytes(pChars, s.Length, pBytes, -1, true));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => encoder.GetByteCount(pChars, -1, true));
|
||||
|
||||
Assert.Throws<ArgumentException>("bytes", () => encoder.GetBytes(pChars, s.Length, pBytes, 1, true));
|
||||
AssertExtensions.Throws<ArgumentException>("bytes", () => encoder.GetBytes(pChars, s.Length, pBytes, 1, true));
|
||||
}
|
||||
|
||||
encoder = Encoding.GetEncoding("us-ascii", new EncoderExceptionFallback(), new DecoderExceptionFallback()).GetEncoder();
|
||||
@@ -159,11 +159,11 @@ namespace System.Text.Tests
|
||||
|
||||
byte[] b = new byte[byteLength];
|
||||
|
||||
Assert.Throws<ArgumentException>("bytes", () => encoder.GetBytes(chars, 0, length, new byte[byteLength], 0, flush: true));
|
||||
AssertExtensions.Throws<ArgumentException>("bytes", () => encoder.GetBytes(chars, 0, length, new byte[byteLength], 0, flush: true));
|
||||
|
||||
// Fixed buffer so make larger
|
||||
b = new byte[20];
|
||||
Assert.Throws<ArgumentException>("bytes", () => VerificationFixedEncodingHelper(encoder, chars, length, b, byteLength));
|
||||
AssertExtensions.Throws<ArgumentException>("bytes", () => VerificationFixedEncodingHelper(encoder, chars, length, b, byteLength));
|
||||
}
|
||||
|
||||
private static unsafe void VerificationFixedEncodingHelper(Encoder encoder, char[] c, int charCount, byte[] b, int byteCount)
|
||||
|
||||
@@ -44,6 +44,16 @@ namespace System.Text.Encodings.Tests
|
||||
Assert.Equal(enc.GetBytes("Some string"), Encoding.Default.GetBytes("Some string"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Full framework uses system ACP and not UTF8")]
|
||||
[ActiveIssue("https://github.com/dotnet/corefx/issues/20715 - Sync up Encoding code between CoreRT and CoreCLR", TargetFrameworkMonikers.UapAot)]
|
||||
public static void DefaultEncodingBOMTest()
|
||||
{
|
||||
UTF8Encoding defaultEncoding = Encoding.Default as UTF8Encoding;
|
||||
Assert.True(defaultEncoding != null);
|
||||
Assert.Equal(0, defaultEncoding.GetPreamble().Length);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void GetEncodingsTest()
|
||||
{
|
||||
@@ -59,6 +69,7 @@ namespace System.Text.Encodings.Tests
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(Encoding_TestData))]
|
||||
[ActiveIssue("https://github.com/dotnet/corefx/issues/20715 - Sync up Encoding code between CoreRT and CoreCLR", TargetFrameworkMonikers.UapAot)]
|
||||
public static void NormalizationTest(int codepage, string name, string bodyName, string headerName, bool isBrowserDisplay,
|
||||
bool isBrowserSave, bool isMailNewsDisplay, bool isMailNewsSave, int windowsCodePage)
|
||||
{
|
||||
@@ -75,6 +86,7 @@ namespace System.Text.Encodings.Tests
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(Normalization_TestData))]
|
||||
[ActiveIssue("https://github.com/dotnet/corefx/issues/20715 - Sync up Encoding code between CoreRT and CoreCLR", TargetFrameworkMonikers.UapAot)]
|
||||
public static void NormalizationTest(int codepage, bool normalized, bool normalizedC, bool normalizedD, bool normalizedKC, bool normalizedKD)
|
||||
{
|
||||
Encoding encoding = Encoding.GetEncoding(codepage);
|
||||
@@ -41,25 +41,25 @@ namespace System.Text.Tests
|
||||
public void Convert_Invalid()
|
||||
{
|
||||
// Bytes is null
|
||||
Assert.Throws<ArgumentNullException>("bytes", () => Encoding.Convert(Encoding.ASCII, Encoding.ASCII, null));
|
||||
Assert.Throws<ArgumentNullException>("bytes", () => Encoding.Convert(Encoding.ASCII, Encoding.ASCII, null, 0, 0));
|
||||
AssertExtensions.Throws<ArgumentNullException>("bytes", () => Encoding.Convert(Encoding.ASCII, Encoding.ASCII, null));
|
||||
AssertExtensions.Throws<ArgumentNullException>("bytes", () => Encoding.Convert(Encoding.ASCII, Encoding.ASCII, null, 0, 0));
|
||||
|
||||
// SrcEncoding is null
|
||||
Assert.Throws<ArgumentNullException>("srcEncoding", () => Encoding.Convert(null, Encoding.ASCII, new byte[0]));
|
||||
Assert.Throws<ArgumentNullException>("srcEncoding", () => Encoding.Convert(null, Encoding.ASCII, new byte[0], 0, 0));
|
||||
AssertExtensions.Throws<ArgumentNullException>("srcEncoding", () => Encoding.Convert(null, Encoding.ASCII, new byte[0]));
|
||||
AssertExtensions.Throws<ArgumentNullException>("srcEncoding", () => Encoding.Convert(null, Encoding.ASCII, new byte[0], 0, 0));
|
||||
|
||||
// DstEncoding is null
|
||||
Assert.Throws<ArgumentNullException>("dstEncoding", () => Encoding.Convert(Encoding.ASCII, null, new byte[0]));
|
||||
Assert.Throws<ArgumentNullException>("dstEncoding", () => Encoding.Convert(Encoding.ASCII, null, new byte[0], 0, 0));
|
||||
AssertExtensions.Throws<ArgumentNullException>("dstEncoding", () => Encoding.Convert(Encoding.ASCII, null, new byte[0]));
|
||||
AssertExtensions.Throws<ArgumentNullException>("dstEncoding", () => Encoding.Convert(Encoding.ASCII, null, new byte[0], 0, 0));
|
||||
|
||||
// Invalid index
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => Encoding.Convert(Encoding.ASCII, Encoding.ASCII, new byte[10], -1, 0));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("bytes", () => Encoding.Convert(Encoding.ASCII, Encoding.ASCII, new byte[10], 11, 0));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => Encoding.Convert(Encoding.ASCII, Encoding.ASCII, new byte[10], -1, 0));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("bytes", () => Encoding.Convert(Encoding.ASCII, Encoding.ASCII, new byte[10], 11, 0));
|
||||
|
||||
// Invalid count
|
||||
Assert.Throws<ArgumentOutOfRangeException>("count", () => Encoding.Convert(Encoding.ASCII, Encoding.ASCII, new byte[10], 0, -1));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("bytes", () => Encoding.Convert(Encoding.ASCII, Encoding.ASCII, new byte[10], 0, 11));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("bytes", () => Encoding.Convert(Encoding.ASCII, Encoding.ASCII, new byte[10], 1, 10));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => Encoding.Convert(Encoding.ASCII, Encoding.ASCII, new byte[10], 0, -1));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("bytes", () => Encoding.Convert(Encoding.ASCII, Encoding.ASCII, new byte[10], 0, 11));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("bytes", () => Encoding.Convert(Encoding.ASCII, Encoding.ASCII, new byte[10], 1, 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ namespace System.Text.Tests
|
||||
[Fact]
|
||||
public void Ctor_NegativeCodePage_ThrowsArgumentOutOfRangeException()
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>("codePage", () => new CustomEncoding(-1));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("codePage", () => new CustomEncoding(-1, null, null));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("codePage", () => new CustomEncoding(-1));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("codePage", () => new CustomEncoding(-1, null, null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -12,19 +12,19 @@ namespace System.Text.Tests
|
||||
[Fact]
|
||||
public void GetEncoding_String_Invalid()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>("name", () => Encoding.GetEncoding(null));
|
||||
Assert.Throws<ArgumentException>("name", () => Encoding.GetEncoding("no-such-encoding-name"));
|
||||
AssertExtensions.Throws<ArgumentNullException>("name", () => Encoding.GetEncoding(null));
|
||||
AssertExtensions.Throws<ArgumentException>("name", () => Encoding.GetEncoding("no-such-encoding-name"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetEncoding_Int_Invalid()
|
||||
{
|
||||
// Codepage is out of range
|
||||
Assert.Throws<ArgumentOutOfRangeException>("codepage", () => Encoding.GetEncoding(-1));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("codepage", () => Encoding.GetEncoding(65536));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("codepage", () => Encoding.GetEncoding(-1));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("codepage", () => Encoding.GetEncoding(65536));
|
||||
|
||||
// Codepage doesn't exist
|
||||
Assert.Throws<ArgumentException>("codepage", () => Encoding.GetEncoding(42));
|
||||
AssertExtensions.Throws<ArgumentException>("codepage", () => Encoding.GetEncoding(42));
|
||||
Assert.Throws<NotSupportedException>(() => Encoding.GetEncoding(54321));
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace System.Text.Tests
|
||||
[Fact]
|
||||
public void Ctor_Invalid()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>("replacement", () => new DecoderReplacementFallback(null));
|
||||
AssertExtensions.Throws<ArgumentNullException>("replacement", () => new DecoderReplacementFallback(null));
|
||||
|
||||
// Invalid surrogate pair
|
||||
Assert.Throws<ArgumentException>(() => new DecoderReplacementFallback("\uD800"));
|
||||
@@ -92,7 +92,7 @@ namespace System.Text.Tests
|
||||
DecoderFallbackBuffer buffer = new DecoderReplacementFallback(replacement).CreateFallbackBuffer();
|
||||
buffer.Fallback(new byte[] { 1 }, 0);
|
||||
|
||||
Assert.Throws<ArgumentException>("bytesUnknown", () => buffer.Fallback(new byte[] { 1 }, 0));
|
||||
AssertExtensions.Throws<ArgumentException>("bytesUnknown", () => buffer.Fallback(new byte[] { 1 }, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,8 +54,8 @@ namespace System.Text.Tests
|
||||
{
|
||||
EncoderFallbackBuffer buffer = new EncoderExceptionFallback().CreateFallbackBuffer();
|
||||
|
||||
Assert.Throws<ArgumentOutOfRangeException>("charUnknownHigh", () => buffer.Fallback('a', '\uDC00', 0));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("charUnknownLow", () => buffer.Fallback('\uD800', 'a', 0));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("charUnknownHigh", () => buffer.Fallback('a', '\uDC00', 0));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("charUnknownLow", () => buffer.Fallback('\uD800', 'a', 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -64,8 +64,8 @@ namespace System.Text.Tests
|
||||
{
|
||||
EncoderFallbackBuffer buffer = new EncoderExceptionFallback().CreateFallbackBuffer();
|
||||
|
||||
Assert.Throws<ArgumentOutOfRangeException>("charUnknownHigh", () => buffer.Fallback('a', '\uDC00', 0));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("CharUnknownLow", () => buffer.Fallback('\uD800', 'a', 0));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("charUnknownHigh", () => buffer.Fallback('a', '\uDC00', 0));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("CharUnknownLow", () => buffer.Fallback('\uD800', 'a', 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace System.Text.Tests
|
||||
[Fact]
|
||||
public void Ctor_Invalid()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>("replacement", () => new EncoderReplacementFallback(null));
|
||||
AssertExtensions.Throws<ArgumentNullException>("replacement", () => new EncoderReplacementFallback(null));
|
||||
|
||||
// Invalid surrogate pair
|
||||
Assert.Throws<ArgumentException>(() => new EncoderReplacementFallback("\uD800"));
|
||||
@@ -90,8 +90,8 @@ namespace System.Text.Tests
|
||||
EncoderFallbackBuffer buffer = new EncoderReplacementFallback(replacement).CreateFallbackBuffer();
|
||||
buffer.Fallback('a', 0);
|
||||
|
||||
Assert.Throws<ArgumentException>("chars", () => buffer.Fallback('a', 0));
|
||||
Assert.Throws<ArgumentException>("chars", () => buffer.Fallback('\uD800', '\uDC00', 0));
|
||||
AssertExtensions.Throws<ArgumentException>("chars", () => buffer.Fallback('a', 0));
|
||||
AssertExtensions.Throws<ArgumentException>("chars", () => buffer.Fallback('\uD800', '\uDC00', 0));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -109,8 +109,8 @@ namespace System.Text.Tests
|
||||
{
|
||||
EncoderFallbackBuffer buffer = new EncoderReplacementFallback().CreateFallbackBuffer();
|
||||
|
||||
Assert.Throws<ArgumentOutOfRangeException>("charUnknownHigh", () => buffer.Fallback('a', '\uDC00', 0));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("charUnknownLow", () => buffer.Fallback('\uD800', 'a', 0));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("charUnknownHigh", () => buffer.Fallback('a', '\uDC00', 0));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("charUnknownLow", () => buffer.Fallback('\uD800', 'a', 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -119,8 +119,8 @@ namespace System.Text.Tests
|
||||
{
|
||||
EncoderFallbackBuffer buffer = new EncoderReplacementFallback().CreateFallbackBuffer();
|
||||
|
||||
Assert.Throws<ArgumentOutOfRangeException>("charUnknownHigh", () => buffer.Fallback('a', '\uDC00', 0));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("CharUnknownLow", () => buffer.Fallback('\uD800', 'a', 0));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("charUnknownHigh", () => buffer.Fallback('a', '\uDC00', 0));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("CharUnknownLow", () => buffer.Fallback('\uD800', 'a', 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,8 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xunit;
|
||||
|
||||
@@ -14,20 +15,20 @@ namespace System.Text.Tests
|
||||
public static unsafe void GetByteCount_Invalid_NetCoreApp(Encoding encoding)
|
||||
{
|
||||
// Chars is null
|
||||
Assert.Throws<ArgumentNullException>("s", () => encoding.GetByteCount((string)null, 0, 0));
|
||||
AssertExtensions.Throws<ArgumentNullException>("s", () => encoding.GetByteCount((string)null, 0, 0));
|
||||
|
||||
// Index < 0
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetByteCount("abc", -1, 0));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetByteCount("abc", -1, 0));
|
||||
|
||||
// Count < 0
|
||||
Assert.Throws<ArgumentOutOfRangeException>("count", () => encoding.GetByteCount("abc", 0, -1));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => encoding.GetByteCount("abc", 0, -1));
|
||||
|
||||
// Index + count > chars.Length
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetByteCount("abc", 0, 4));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetByteCount("abc", 1, 3));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetByteCount("abc", 2, 2));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetByteCount("abc", 3, 1));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetByteCount("abc", 4, 0));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetByteCount("abc", 0, 4));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetByteCount("abc", 1, 3));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetByteCount("abc", 2, 2));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetByteCount("abc", 3, 1));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetByteCount("abc", 4, 0));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -35,18 +36,18 @@ namespace System.Text.Tests
|
||||
public static unsafe void GetBytes_Invalid_NetCoreApp(Encoding encoding)
|
||||
{
|
||||
// Source is null
|
||||
Assert.Throws<ArgumentNullException>("s", () => encoding.GetBytes((string)null, 0, 0));
|
||||
AssertExtensions.Throws<ArgumentNullException>("s", () => encoding.GetBytes((string)null, 0, 0));
|
||||
|
||||
// CharIndex < 0
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetBytes("a", -1, 0));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetBytes("a", -1, 0));
|
||||
|
||||
// CharCount < 0
|
||||
Assert.Throws<ArgumentOutOfRangeException>("count", () => encoding.GetBytes("a", 0, -1));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => encoding.GetBytes("a", 0, -1));
|
||||
|
||||
// CharIndex + charCount > source.Length
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetBytes("a", 2, 0));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetBytes("a", 1, 1));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetBytes("a", 0, 2));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetBytes("a", 2, 0));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetBytes("a", 1, 1));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => encoding.GetBytes("a", 0, 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace System.Text.Tests
|
||||
{
|
||||
public static IEnumerable<object[]> EncodingSizeData()
|
||||
{
|
||||
int[] sizes = new int[] { 10000, 1000000 };
|
||||
int[] sizes = new int[] { 16, 32, 64, 128, 256, 512, 10000, 1000000 };
|
||||
string[] encs = new string[] { "utf-8", "ascii" };
|
||||
foreach (int size in sizes)
|
||||
foreach (string enc in encs)
|
||||
|
||||
@@ -75,10 +75,13 @@
|
||||
<Compile Include="UTF8Encoding\UTF8EncodingGetMaxCharCount.cs" />
|
||||
<Compile Include="UTF8Encoding\UTF8EncodingTests.cs" />
|
||||
<Compile Include="$(CommonTestPath)\System\RandomDataGenerator.cs" />
|
||||
<Compile Include="Encoding\Encoding.netstandard.cs" />
|
||||
<Compile Include="UnicodeEncoding\UnicodeEncoding.netstandard.cs" />
|
||||
<Compile Include="Decoder\Decoder.netstandard.cs" />
|
||||
<Compile Include="Encoder\Encoder.netstandard.cs" />
|
||||
<Compile Include="Encoding\Encoding.cs" />
|
||||
<Compile Include="UnicodeEncoding\UnicodeEncoding.cs" />
|
||||
<Compile Include="Decoder\Decoder.cs" />
|
||||
<Compile Include="Encoder\Encoder.cs" />
|
||||
<Compile Include="$(CommonTestPath)\System\AssertExtensions.cs">
|
||||
<Link>Common\System\AssertExtensions.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -85,6 +85,7 @@ namespace System.Text.Tests
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(Encodings_TestData))]
|
||||
[ActiveIssue("https://github.com/dotnet/corefx/issues/20715 - Sync up Encoding code between CoreRT and CoreCLR", TargetFrameworkMonikers.UapAot)]
|
||||
public void WebName(UTF32Encoding encoding, string webName)
|
||||
{
|
||||
Assert.Equal(webName, encoding.WebName);
|
||||
|
||||
@@ -103,6 +103,7 @@ namespace System.Text.Tests
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(Decode_TestData))]
|
||||
[ActiveIssue("https://github.com/dotnet/corefx/issues/20525", TargetFrameworkMonikers.UapAot)]
|
||||
public void Decode(byte[] bytes, int index, int count, string expected)
|
||||
{
|
||||
EncodingHelpers.Decode(new UTF8Encoding(true, false), bytes, index, count, expected);
|
||||
|
||||
@@ -202,22 +202,22 @@ namespace System.Text.Tests
|
||||
Encoding encoding = Encoding.UTF8;
|
||||
// Bytes does not have enough capacity to accomodate result
|
||||
string s = "T\uD83D\uDE01est";
|
||||
Assert.Throws<ArgumentException>("bytes", () => encoding.GetBytes(s, 0, 2, new byte[3], 0));
|
||||
Assert.Throws<ArgumentException>("bytes", () => encoding.GetBytes(s, 0, 3, new byte[4], 0));
|
||||
Assert.Throws<ArgumentException>("bytes", () => encoding.GetBytes(s, 0, 4, new byte[5], 0));
|
||||
Assert.Throws<ArgumentException>("bytes", () => encoding.GetBytes(s, 0, 5, new byte[6], 0));
|
||||
AssertExtensions.Throws<ArgumentException>("bytes", () => encoding.GetBytes(s, 0, 2, new byte[3], 0));
|
||||
AssertExtensions.Throws<ArgumentException>("bytes", () => encoding.GetBytes(s, 0, 3, new byte[4], 0));
|
||||
AssertExtensions.Throws<ArgumentException>("bytes", () => encoding.GetBytes(s, 0, 4, new byte[5], 0));
|
||||
AssertExtensions.Throws<ArgumentException>("bytes", () => encoding.GetBytes(s, 0, 5, new byte[6], 0));
|
||||
|
||||
char[] c = s.ToCharArray();
|
||||
Assert.Throws<ArgumentException>("bytes", () => encoding.GetBytes(c, 0, 2, new byte[3], 0));
|
||||
Assert.Throws<ArgumentException>("bytes", () => encoding.GetBytes(c, 0, 3, new byte[4], 0));
|
||||
Assert.Throws<ArgumentException>("bytes", () => encoding.GetBytes(c, 0, 4, new byte[5], 0));
|
||||
Assert.Throws<ArgumentException>("bytes", () => encoding.GetBytes(c, 0, 5, new byte[6], 0));
|
||||
AssertExtensions.Throws<ArgumentException>("bytes", () => encoding.GetBytes(c, 0, 2, new byte[3], 0));
|
||||
AssertExtensions.Throws<ArgumentException>("bytes", () => encoding.GetBytes(c, 0, 3, new byte[4], 0));
|
||||
AssertExtensions.Throws<ArgumentException>("bytes", () => encoding.GetBytes(c, 0, 4, new byte[5], 0));
|
||||
AssertExtensions.Throws<ArgumentException>("bytes", () => encoding.GetBytes(c, 0, 5, new byte[6], 0));
|
||||
|
||||
byte[] b = new byte[8];
|
||||
Assert.Throws<ArgumentException>("bytes", () => FixedEncodingHelper(c, 2, b, 3));
|
||||
Assert.Throws<ArgumentException>("bytes", () => FixedEncodingHelper(c, 3, b, 4));
|
||||
Assert.Throws<ArgumentException>("bytes", () => FixedEncodingHelper(c, 4, b, 5));
|
||||
Assert.Throws<ArgumentException>("bytes", () => FixedEncodingHelper(c, 5, b, 6));
|
||||
AssertExtensions.Throws<ArgumentException>("bytes", () => FixedEncodingHelper(c, 2, b, 3));
|
||||
AssertExtensions.Throws<ArgumentException>("bytes", () => FixedEncodingHelper(c, 3, b, 4));
|
||||
AssertExtensions.Throws<ArgumentException>("bytes", () => FixedEncodingHelper(c, 4, b, 5));
|
||||
AssertExtensions.Throws<ArgumentException>("bytes", () => FixedEncodingHelper(c, 5, b, 6));
|
||||
}
|
||||
|
||||
private static unsafe void FixedEncodingHelper(char[] c, int charCount, byte[] b, int byteCount)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user