summaryrefslogtreecommitdiff
path: root/tests/src/CoreMangLib/system
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/CoreMangLib/system')
-rw-r--r--tests/src/CoreMangLib/system/delegate/miscellaneous/ClosedStatic.csproj14
-rw-r--r--tests/src/CoreMangLib/system/delegate/regressions/Github_13160/Github_13160.cs52
-rw-r--r--tests/src/CoreMangLib/system/delegate/regressions/Github_13160/Github_13160.csproj40
-rw-r--r--tests/src/CoreMangLib/system/span/BasicSpanTest.cs56
4 files changed, 98 insertions, 64 deletions
diff --git a/tests/src/CoreMangLib/system/delegate/miscellaneous/ClosedStatic.csproj b/tests/src/CoreMangLib/system/delegate/miscellaneous/ClosedStatic.csproj
index 6569ad3723..cba934e6cd 100644
--- a/tests/src/CoreMangLib/system/delegate/miscellaneous/ClosedStatic.csproj
+++ b/tests/src/CoreMangLib/system/delegate/miscellaneous/ClosedStatic.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
@@ -11,12 +11,11 @@
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "></PropertyGroup>
<ItemGroup>
<CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
<Visible>False</Visible>
@@ -33,6 +32,5 @@
<WarningLevel Include="1" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
- </PropertyGroup>
-</Project>
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/CoreMangLib/system/delegate/regressions/Github_13160/Github_13160.cs b/tests/src/CoreMangLib/system/delegate/regressions/Github_13160/Github_13160.cs
new file mode 100644
index 0000000000..be90f5e9b1
--- /dev/null
+++ b/tests/src/CoreMangLib/system/delegate/regressions/Github_13160/Github_13160.cs
@@ -0,0 +1,52 @@
+// 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;
+
+class Program
+{
+ public virtual void VirtualMethod()
+ {
+ }
+
+ public void NonVirtualMethod()
+ {
+ }
+
+ static int Main()
+ {
+ Program p = new Program();
+
+ Action d1 = p.VirtualMethod;
+ Action d2 = p.VirtualMethod;
+
+ if (!d1.Equals(d2))
+ {
+ Console.WriteLine("FAILED: d1.Equals(d2) is not true");
+ return 200;
+ }
+
+ if (d1.GetHashCode() != d2.GetHashCode())
+ {
+ Console.WriteLine("FAILED: d1.GetHashCode() != d2.GetHashCode()");
+ return 201;
+ }
+
+ Action d3 = p.NonVirtualMethod;
+ Action d4 = p.NonVirtualMethod;
+
+ if (!d3.Equals(d4))
+ {
+ Console.WriteLine("FAILED: d3.Equals(d4) is not true");
+ return 202;
+ }
+
+ if (d3.GetHashCode() != d4.GetHashCode())
+ {
+ Console.WriteLine("FAILED: d3.GetHashCode() != d4.GetHashCode()");
+ return 203;
+ }
+
+ return 100;
+ }
+}
diff --git a/tests/src/CoreMangLib/system/delegate/regressions/Github_13160/Github_13160.csproj b/tests/src/CoreMangLib/system/delegate/regressions/Github_13160/Github_13160.csproj
new file mode 100644
index 0000000000..e982bf8c3c
--- /dev/null
+++ b/tests/src/CoreMangLib/system/delegate/regressions/Github_13160/Github_13160.csproj
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="Github_13160.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ <ProjectReference Include="../../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/CoreMangLib/system/span/BasicSpanTest.cs b/tests/src/CoreMangLib/system/span/BasicSpanTest.cs
index 18ec6f8474..83ab6b3f81 100644
--- a/tests/src/CoreMangLib/system/span/BasicSpanTest.cs
+++ b/tests/src/CoreMangLib/system/span/BasicSpanTest.cs
@@ -41,10 +41,8 @@ class My
int failedTestsCount = 0;
Test(CanAccessItemsViaIndexer, "CanAccessItemsViaIndexer", ref failedTestsCount);
- Test(CanAccessItemsViaIndexerStartCtor, "CanAccessItemsViaIndexerStartCtor", ref failedTestsCount);
Test(CanAccessItemsViaIndexerStartLengthCtor, "CanAccessItemsViaIndexerStartLengthCtor", ref failedTestsCount);
- Test(TestBoundaryEmptySpanStartCtor, "TestBoundaryEmptySpanStartCtor", ref failedTestsCount);
Test(TestBoundaryEmptySpanStartLengthCtor, "TestBoundaryEmptySpanStartLengthCtor", ref failedTestsCount);
Test(ReferenceTypesAreSupported, "ReferenceTypesAreSupported", ref failedTestsCount);
@@ -54,7 +52,6 @@ class My
Test(MustNotMoveGcTypesToUnmanagedMemory, "MustNotMoveGcTypesToUnmanagedMemory", ref failedTestsCount);
Test(TestArrayCoVariance, "TestArrayCoVariance", ref failedTestsCount);
- Test(TestArrayCoVarianceStartCtor, "TestArrayCoVarianceStartCtor", ref failedTestsCount);
Test(TestArrayCoVarianceStartLengthCtor, "TestArrayCoVarianceStartLengthCtor", ref failedTestsCount);
Test(TestArrayCoVarianceReadOnly, "TestArrayCoVarianceReadOnly", ref failedTestsCount);
@@ -83,7 +80,6 @@ class My
Test(WhenSourceTypeLargerThanTargetAndOverflowsInt32ThrowsException, "WhenSourceTypeLargerThanTargetAndOverflowsInt32ThrowsException", ref failedTestsCount);
Test(CanCreateSpanFromString, "CanCreateSpanFromString", ref failedTestsCount);
- Test(WhenStartLargerThanLengthThrowsExceptionStartCtor, "WhenStartLargerThanLengthThrowsExceptionStartCtor", ref failedTestsCount);
Test(WhenStartLargerThanLengthThrowsExceptionStartLengthCtor, "WhenStartLargerThanLengthThrowsExceptionStartLengthCtor", ref failedTestsCount);
Test(WhenStartAndLengthLargerThanLengthThrowsExceptionStartLengthCtor, "WhenStartAndLengthLargerThanLengthThrowsExceptionStartLengthCtor", ref failedTestsCount);
@@ -101,13 +97,6 @@ class My
AssertTrue(Sum(subslice) == 5, "Failed to sum subslice");
}
- static void CanAccessItemsViaIndexerStartCtor()
- {
- int[] a = new int[] { 1, 2, 3 };
- Span<int> slice = new Span<int>(a, start: 1);
- AssertTrue(Sum(slice) == 5, "Failed to sum slice");
- }
-
static void CanAccessItemsViaIndexerStartLengthCtor()
{
int[] a = new int[] { 1, 2, 3 };
@@ -115,14 +104,6 @@ class My
AssertTrue(Sum(slice) == 2, "Failed to sum slice");
}
- static void TestBoundaryEmptySpanStartCtor()
- {
- int[] a = new int[5];
-
- Span<int> slice = new Span<int>(a, start: a.Length);
- AssertEqual(slice.Length, 0);
- }
-
static void TestBoundaryEmptySpanStartLengthCtor()
{
int[] a = new int[5];
@@ -197,30 +178,6 @@ class My
}
}
- static void TestArrayCoVarianceStartCtor()
- {
- var array = new ReferenceType[1];
- var objArray = (object[])array;
- try
- {
- new Span<object>(objArray, start: 0);
- AssertTrue(false, "Expected exception not thrown");
- }
- catch (ArrayTypeMismatchException)
- {
- }
-
- var objEmptyArray = Array.Empty<ReferenceType>();
- try
- {
- new Span<object>(objEmptyArray, start: 0);
- AssertTrue(false, "Expected exception not thrown");
- }
- catch (ArrayTypeMismatchException)
- {
- }
- }
-
static void TestArrayCoVarianceStartLengthCtor()
{
var array = new ReferenceType[1];
@@ -716,19 +673,6 @@ class My
var spanFromSecondHalf = fullText.Slice(fullText.Length / 2);
AssertEqualContent(secondHalfOfString, spanFromSecondHalf);
}
-
- static void WhenStartLargerThanLengthThrowsExceptionStartCtor()
- {
- try
- {
- var data = new byte[10];
- var slice = new Span<byte>(data, start: 11);
- AssertTrue(false, "Expected exception for Argument Out of Range not thrown");
- }
- catch (System.ArgumentOutOfRangeException)
- {
- }
- }
static void WhenStartLargerThanLengthThrowsExceptionStartLengthCtor()
{