From bff5d8b55adb71afd0f132b9e15646787b07b879 Mon Sep 17 00:00:00 2001 From: Mateo Torres-Ruiz Date: Tue, 1 Jun 2021 09:20:35 -0700 Subject: Add support for UnrecognizedReflectionAccessPattern in analyzer test infra (#2048) * Refactor TestCaseUtils * Whitespace --- test/Mono.Linker.Tests.Cases/DataFlow/FieldDataFlow.cs | 2 +- test/Mono.Linker.Tests.Cases/DataFlow/GetTypeDataFlow.cs | 4 ++-- .../DataFlow/MethodReturnParameterDataFlow.cs | 2 +- test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs | 2 +- test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs | 6 +++--- .../Reflection/RunClassConstructorUsedViaReflection.cs | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) (limited to 'test/Mono.Linker.Tests.Cases') diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/FieldDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/FieldDataFlow.cs index 380b72a70..8b9fc965c 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/FieldDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/FieldDataFlow.cs @@ -143,7 +143,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow TypeStore._staticTypeWithPublicParameterlessConstructor = GetUnkownType (); } - [UnrecognizedReflectionAccessPattern (typeof (TypeStore), nameof (TypeStore._staticTypeWithPublicParameterlessConstructor), messageCode: "IL2064", message: nameof (TypeStore._staticTypeWithPublicParameterlessConstructor))] + [UnrecognizedReflectionAccessPattern (typeof (TypeStore), nameof (TypeStore._staticTypeWithPublicParameterlessConstructor), messageCode: "IL2064", message: new string[] { nameof (TypeStore._staticTypeWithPublicParameterlessConstructor) })] private void WriteUnknownValue () { var array = new object[1]; diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/GetTypeDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/GetTypeDataFlow.cs index 0791625ab..0e6dcf1c7 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/GetTypeDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/GetTypeDataFlow.cs @@ -121,9 +121,9 @@ namespace Mono.Linker.Tests.Cases.DataFlow } [UnrecognizedReflectionAccessPattern (typeof (GetTypeDataFlow), nameof (RequireNonPublicConstructors), new Type[] { typeof (Type) }, - messageCode: "IL2072", message: "GetType")] + messageCode: "IL2072", message: new string[] { "GetType" })] [UnrecognizedReflectionAccessPattern (typeof (Type), nameof (Type.GetType), new Type[] { typeof (string) }, - messageCode: "IL2057", message: "System.Type.GetType(String)")] + messageCode: "IL2057", message: new string[] { "System.Type.GetType(String)" })] static void TestMultipleMixedValues () { string typeName = null; diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/MethodReturnParameterDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/MethodReturnParameterDataFlow.cs index 61f92971a..c46e9ab54 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/MethodReturnParameterDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/MethodReturnParameterDataFlow.cs @@ -127,7 +127,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (ReturnUnknownValue), new Type[] { }, returnType: typeof (Type), - messageCode: "IL2063", message: nameof (ReturnUnknownValue))] + messageCode: "IL2063", message: new string[] { nameof (ReturnUnknownValue) })] [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors)] Type ReturnUnknownValue () { diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs index a8bfbed1f..e1eb09b05 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs @@ -95,7 +95,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow } [UnrecognizedReflectionAccessPattern (typeof (MethodThisDataFlowTypeTest), nameof (MethodThisDataFlowTypeTest.RequireThisNonPublicMethods), new Type[] { }, - messageCode: "IL2065", message: nameof (MethodThisDataFlowTypeTest.RequireThisNonPublicMethods))] + messageCode: "IL2065", message: new string[] { nameof (MethodThisDataFlowTypeTest.RequireThisNonPublicMethods) })] static void TestUnknownThis () { var array = new object[1]; diff --git a/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs b/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs index 7b5f97803..8f1cfae07 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs @@ -307,7 +307,7 @@ namespace Mono.Linker.Tests.Cases.Reflection [Kept] [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type[] { typeof (string), typeof (string) }, - messageCode: "IL2032", message: "assemblyName")] + messageCode: "IL2032", message: new string[] { "assemblyName" })] private static void WithNullAssemblyName () { Activator.CreateInstance (null, "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+WithAssemblyNameParameterless1"); @@ -315,7 +315,7 @@ namespace Mono.Linker.Tests.Cases.Reflection [Kept] [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type[] { typeof (string), typeof (string) }, - messageCode: "IL2061", message: "NonExistingAssembly")] + messageCode: "IL2061", message: new string[] { "NonExistingAssembly" })] private static void WithNonExistingAssemblyName () { Activator.CreateInstance ("NonExistingAssembly", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+WithAssemblyNameParameterless1"); @@ -326,7 +326,7 @@ namespace Mono.Linker.Tests.Cases.Reflection [Kept] [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type[] { typeof (string), typeof (string), typeof (object[]) }, - messageCode: "IL2032", message: "typeName")] + messageCode: "IL2032", message: new string[] { "typeName" })] private static void WithAssemblyAndUnknownTypeName () { Activator.CreateInstance ("test", _typeNameField, new object[] { }); diff --git a/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructorUsedViaReflection.cs b/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructorUsedViaReflection.cs index a4c39a145..e4670746c 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructorUsedViaReflection.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructorUsedViaReflection.cs @@ -48,7 +48,7 @@ namespace Mono.Linker.Tests.Cases.Reflection [Kept] [UnrecognizedReflectionAccessPattern (typeof (RuntimeHelpers), nameof (RuntimeHelpers.RunClassConstructor), new Type[] { typeof (RuntimeTypeHandle) }, - messageCode: "IL2059", message: "RunClassConstructor")] + messageCode: "IL2059", message: new string[] { "RunClassConstructor" })] static void TestDataFlowType () { -- cgit v1.2.3