You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@@ -26,9 +26,6 @@
|
||||
<Compile Include="UmsTests.cs" />
|
||||
<Compile Include="UmsManager.cs" />
|
||||
<Compile Include="UmsSecurityTest.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>
|
||||
@@ -81,10 +81,10 @@ namespace System.IO.Tests
|
||||
using (TestSafeBuffer buffer = new TestSafeBuffer(capacity))
|
||||
using (UnmanagedMemoryAccessor uma = new UnmanagedMemoryAccessor(buffer, 0, capacity, FileAccess.ReadWrite))
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => uma.Write<UmaTestStruct>(capacity - UmaTestStruct_UnalignedSize + 1, ref inStruct));
|
||||
Assert.Throws<ArgumentException>(() => uma.Write<UmaTestStruct>(capacity - UmaTestStruct_AlignedSize + 1, ref inStruct));
|
||||
Assert.Throws<ArgumentException>(() => uma.Read<UmaTestStruct>(capacity - UmaTestStruct_UnalignedSize + 1, out inStruct));
|
||||
Assert.Throws<ArgumentException>(() => uma.Read<UmaTestStruct>(capacity - UmaTestStruct_AlignedSize + 1, out inStruct));
|
||||
AssertExtensions.Throws<ArgumentException>("position", () => uma.Write<UmaTestStruct>(capacity - UmaTestStruct_UnalignedSize + 1, ref inStruct));
|
||||
AssertExtensions.Throws<ArgumentException>("position", () => uma.Write<UmaTestStruct>(capacity - UmaTestStruct_AlignedSize + 1, ref inStruct));
|
||||
AssertExtensions.Throws<ArgumentException>("position", () => uma.Read<UmaTestStruct>(capacity - UmaTestStruct_UnalignedSize + 1, out inStruct));
|
||||
AssertExtensions.Throws<ArgumentException>("position", () => uma.Read<UmaTestStruct>(capacity - UmaTestStruct_AlignedSize + 1, out inStruct));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace System.IO.Tests
|
||||
public class Uma_ReadWriteStructArray : Uma_TestStructs
|
||||
{
|
||||
[Fact]
|
||||
[ActiveIssue("https://github.com/dotnet/corefx/issues/20522", TargetFrameworkMonikers.UapAot)]
|
||||
public static void UmaReadWriteStructArray_InvalidParameters()
|
||||
{
|
||||
const int capacity = 100;
|
||||
@@ -24,10 +23,10 @@ namespace System.IO.Tests
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("offset", () => uma.ReadArray<UmaTestStruct>(0, structArr, -1, 1));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => uma.WriteArray<UmaTestStruct>(0, structArr, 0, -1));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => uma.ReadArray<UmaTestStruct>(0, structArr, 0, -1));
|
||||
Assert.Throws<ArgumentException>(() => uma.WriteArray<UmaTestStruct>(0, structArr, 2, 0));
|
||||
Assert.Throws<ArgumentException>(() => uma.ReadArray<UmaTestStruct>(0, structArr, 2, 0));
|
||||
Assert.Throws<ArgumentException>(() => uma.WriteArray<UmaTestStruct>(0, structArr, 0, 2));
|
||||
Assert.Throws<ArgumentException>(() => uma.ReadArray<UmaTestStruct>(0, structArr, 0, 2));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => uma.WriteArray<UmaTestStruct>(0, structArr, 2, 0));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => uma.ReadArray<UmaTestStruct>(0, structArr, 2, 0));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => uma.WriteArray<UmaTestStruct>(0, structArr, 0, 2));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => uma.ReadArray<UmaTestStruct>(0, structArr, 0, 2));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("position", () => uma.WriteArray<UmaTestStruct>(-1, structArr, 0, 1));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("position", () => uma.ReadArray<UmaTestStruct>(-1, structArr, 0, 1));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("position", () => uma.WriteArray<UmaTestStruct>(capacity, structArr, 0, 1));
|
||||
@@ -81,8 +80,8 @@ namespace System.IO.Tests
|
||||
using (TestSafeBuffer buffer = new TestSafeBuffer(capacity))
|
||||
using (UnmanagedMemoryAccessor uma = new UnmanagedMemoryAccessor(buffer, 0, capacity, FileAccess.ReadWrite))
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => uma.WriteArray<UmaTestStruct>(capacity - UmaTestStruct_UnalignedSize + 1, structArr, 0, 1));
|
||||
Assert.Throws<ArgumentException>(() => uma.WriteArray<UmaTestStruct>(capacity - UmaTestStruct_AlignedSize + 1, structArr, 0, 1));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => uma.WriteArray<UmaTestStruct>(capacity - UmaTestStruct_UnalignedSize + 1, structArr, 0, 1));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => uma.WriteArray<UmaTestStruct>(capacity - UmaTestStruct_AlignedSize + 1, structArr, 0, 1));
|
||||
Assert.Equal(0, uma.ReadArray<UmaTestStruct>(capacity - UmaTestStruct_UnalignedSize + 1, structArr, 0, 1));
|
||||
Assert.Equal(0, uma.ReadArray<UmaTestStruct>(capacity - UmaTestStruct_AlignedSize + 1, structArr, 0, 1));
|
||||
}
|
||||
|
||||
@@ -45,11 +45,11 @@ namespace System.IO.Tests
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new UnmanagedMemoryAccessor(fakeBuffer, 1, 2, (FileAccess)(-1)));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new UnmanagedMemoryAccessor(fakeBuffer, 1, 2, (FileAccess)42));
|
||||
|
||||
Assert.Throws<ArgumentException>(() => new UnmanagedMemoryAccessor(fakeBuffer, 2, 999));
|
||||
Assert.Throws<ArgumentException>(() => new UnmanagedMemoryAccessor(fakeBuffer, 999, 9));
|
||||
Assert.Throws<ArgumentException>(() => new UnmanagedMemoryAccessor(fakeBuffer, 1, 100));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => new UnmanagedMemoryAccessor(fakeBuffer, 2, 999));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => new UnmanagedMemoryAccessor(fakeBuffer, 999, 9));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => new UnmanagedMemoryAccessor(fakeBuffer, 1, 100));
|
||||
|
||||
Assert.Throws<ArgumentException>(() => new UnmanagedMemoryAccessor(fakeBuffer, Int32.MaxValue, 1));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => new UnmanagedMemoryAccessor(fakeBuffer, Int32.MaxValue, 1));
|
||||
}
|
||||
|
||||
// Derived class used to exercise protected members and to test behaviors before and after initialization
|
||||
|
||||
@@ -18,11 +18,11 @@ namespace System.IO.Tests
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => uma.ReadChar(-1));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => uma.ReadDecimal(capacity));
|
||||
Assert.Throws<ArgumentException>(() => uma.ReadSingle(capacity - 1));
|
||||
AssertExtensions.Throws<ArgumentException>("position", () => uma.ReadSingle(capacity - 1));
|
||||
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => uma.Write(-1, true));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => uma.Write(capacity, 12345));
|
||||
Assert.Throws<ArgumentException>(() => uma.Write(capacity - 1, 0.123));
|
||||
AssertExtensions.Throws<ArgumentException>("position", () => uma.Write(capacity - 1, 0.123));
|
||||
|
||||
uma.Dispose();
|
||||
Assert.Throws<ObjectDisposedException>(() => uma.ReadByte(0));
|
||||
@@ -53,7 +53,7 @@ namespace System.IO.Tests
|
||||
uma.Write(4, 0); // mid
|
||||
uma.Write(8, 0); // hi
|
||||
uma.Write(12, -1); // flags (all bits are set, so this should raise an exception)
|
||||
Assert.Throws<ArgumentException>(() => uma.ReadDecimal(0)); // Should throw same exception as decimal(int[]) ctor for compat
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => uma.ReadDecimal(0)); // Should throw same exception as decimal(int[]) ctor for compat
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ namespace System.IO.Tests
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new UnmanagedMemoryStream(fakeBuffer, 1, 2, (FileAccess)(-1)));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new UnmanagedMemoryStream(fakeBuffer, 1, 2, (FileAccess)42));
|
||||
|
||||
Assert.Throws<ArgumentException>(() => new UnmanagedMemoryStream(fakeBuffer, 2, 999));
|
||||
Assert.Throws<ArgumentException>(() => new UnmanagedMemoryStream(fakeBuffer, 999, 9));
|
||||
Assert.Throws<ArgumentException>(() => new UnmanagedMemoryStream(fakeBuffer, 1, 100));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => new UnmanagedMemoryStream(fakeBuffer, 2, 999));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => new UnmanagedMemoryStream(fakeBuffer, 999, 9));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => new UnmanagedMemoryStream(fakeBuffer, 1, 100));
|
||||
|
||||
Assert.Throws<ArgumentException>(() => new UnmanagedMemoryStream(fakeBuffer, Int32.MaxValue, 1));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => new UnmanagedMemoryStream(fakeBuffer, Int32.MaxValue, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -122,14 +122,14 @@ namespace System.IO.Tests
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => stream.WriteAsync(new byte[] { }, 1, -2).GetAwaiter().GetResult());
|
||||
|
||||
//case#6: call Read with count > ums.Length-startIndex, ArgumentOutOfRangeException should be thrown.
|
||||
Assert.Throws<ArgumentException>(() => stream.Read(new byte[10], 0, 11)); // "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection."
|
||||
Assert.Throws<ArgumentException>(() => stream.ReadAsync(new byte[10], 0, 11).GetAwaiter().GetResult());
|
||||
Assert.Throws<ArgumentException>(() => stream.Write(new byte[3], 0, 4));
|
||||
Assert.Throws<ArgumentException>(() => stream.WriteAsync(new byte[3], 0, 4).GetAwaiter().GetResult());
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => stream.Read(new byte[10], 0, 11)); // "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection."
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => stream.ReadAsync(new byte[10], 0, 11).GetAwaiter().GetResult());
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => stream.Write(new byte[3], 0, 4));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => stream.WriteAsync(new byte[3], 0, 4).GetAwaiter().GetResult());
|
||||
|
||||
//case#10: Call Read on a n length stream, (Capacity is implicitly n), position is set to end, call it, should throw ArgumentException.
|
||||
Assert.Throws<ArgumentException>(() => stream.Read(new byte[] { }, 0, 1));
|
||||
Assert.Throws<ArgumentException>(() => stream.Write(new byte[] { }, 0, 1));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => stream.Read(new byte[] { }, 0, 1));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => stream.Write(new byte[] { }, 0, 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace System.IO.Tests
|
||||
|
||||
Assert.Throws<IOException>(() => stream.Seek(unchecked(Int32.MaxValue + 1), SeekOrigin.Begin));
|
||||
Assert.Throws<IOException>(() => stream.Seek(Int64.MinValue, SeekOrigin.End));
|
||||
Assert.Throws<ArgumentException>(() => stream.Seek(0, (SeekOrigin)7)); // Invalid seek origin
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => stream.Seek(0, (SeekOrigin)7)); // Invalid seek origin
|
||||
|
||||
stream.Seek(10, SeekOrigin.Begin);
|
||||
Assert.Equal(10, stream.Position);
|
||||
|
||||
Reference in New Issue
Block a user