diff options
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/Reflection')
4 files changed, 23 insertions, 22 deletions
diff --git a/test/Mono.Linker.Tests.Cases/Reflection/ConstructorUsedViaReflection.cs b/test/Mono.Linker.Tests.Cases/Reflection/ConstructorUsedViaReflection.cs index 16851b0cf..5588f4196 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/ConstructorUsedViaReflection.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/ConstructorUsedViaReflection.cs @@ -7,11 +7,17 @@ namespace Mono.Linker.Tests.Cases.Reflection public class ConstructorUsedViaReflection { public static void Main () { - var constructor = typeof (OnlyUsedViaReflection).GetConstructor (BindingFlags.Public, null, new Type[]{}, new ParameterModifier[]{}); + var constructor = typeof (OnlyUsedViaReflection).GetConstructor (BindingFlags.Public, GetNullValue ("some argument", 2, 3), new Type[]{}, new ParameterModifier[]{}); constructor.Invoke (null, new object[] { }); } [Kept] + static Binder GetNullValue (string str, int i, long g) + { + return null; + } + + [Kept] private class OnlyUsedViaReflection { [Kept] public OnlyUsedViaReflection () diff --git a/test/Mono.Linker.Tests.Cases/Reflection/MightKeepExtraThings.cs b/test/Mono.Linker.Tests.Cases/Reflection/MightKeepExtraThings.cs index 091885e28..2e0db6daa 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/MightKeepExtraThings.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/MightKeepExtraThings.cs @@ -3,7 +3,9 @@ using System.Reflection; using Mono.Linker.Tests.Cases.Expectations.Assertions; namespace Mono.Linker.Tests.Cases.Reflection { - public class MightKeepExtraThings { + [IgnoreTestCase ("Reflection tracking for simple locals loads")] + public class MightKeepExtraThings + { public static void Main () { new A (); // Needed to avoid lazy body marking stubbing @@ -25,8 +27,6 @@ namespace Mono.Linker.Tests.Cases.Reflection { } } - [Kept] - [KeptMember (".ctor()")] public class B { [Kept] public int Foo () diff --git a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs index 1fcef6673..93c7eeb5c 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs @@ -26,14 +26,14 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] public static void TestNull () { - string reflectionTypeKeptString = null; + const string reflectionTypeKeptString = null; var typeKept = Type.GetType (reflectionTypeKeptString, false); } [Kept] public static void TestEmptyString () { - string reflectionTypeKeptString = ""; + const string reflectionTypeKeptString = ""; var typeKept = Type.GetType (reflectionTypeKeptString, false); } @@ -43,7 +43,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] public static void TestFullString () { - var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+Full, test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"; + const string reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+Full, test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"; var typeKept = Type.GetType (reflectionTypeKeptString, false); } @@ -53,7 +53,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] public static void TestGenericString () { - var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+Generic`1, test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"; + const string reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+Generic`1, test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"; var typeKept = Type.GetType (reflectionTypeKeptString, false); } @@ -73,7 +73,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] public static void TestTypeAsmName () { - var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+TypeAsmName, test"; + const string reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+TypeAsmName, test"; var typeKept = Type.GetType (reflectionTypeKeptString, false); } @@ -83,7 +83,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] public static void TestType () { - var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+AType"; + const string reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+AType"; var typeKept = Type.GetType (reflectionTypeKeptString, false); } @@ -93,7 +93,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] public static void TestPointer () { - var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+Pointer*"; + const string reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+Pointer*"; var typeKept = Type.GetType (reflectionTypeKeptString, false); } @@ -103,7 +103,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] public static void TestReference () { - var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+Reference&"; + const string reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+Reference&"; var typeKept = Type.GetType (reflectionTypeKeptString, false); } @@ -113,7 +113,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] public static void TestArray () { - var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+Array[]"; + const string reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+Array[]"; var typeKept = Type.GetType (reflectionTypeKeptString, false); } @@ -123,7 +123,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] public static void TestArrayOfArray () { - var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+ArrayOfArray[][]"; + const string reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+ArrayOfArray[][]"; var typeKept = Type.GetType (reflectionTypeKeptString, false); } @@ -134,7 +134,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] public static void TestMultiDimensionalArray () { - var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+MultiDimensionalArray[,]"; + const string reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+MultiDimensionalArray[,]"; var typeKept = Type.GetType (reflectionTypeKeptString, false); } @@ -144,7 +144,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] public static void TestMultiDimensionalArrayFullString () { - var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+MultiDimensionalArrayFullString[,], test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"; + const string reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+MultiDimensionalArrayFullString[,], test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"; var typeKept = Type.GetType (reflectionTypeKeptString, false); } @@ -154,7 +154,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] public static void TestMultiDimensionalArrayAsmName () { - var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+MultiDimensionalArrayAsmName[,], test"; + const string reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+MultiDimensionalArrayAsmName[,], test"; var typeKept = Type.GetType (reflectionTypeKeptString, false); } } diff --git a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionLdstrValidButChanged.cs b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionLdstrValidButChanged.cs index c4e6b6a38..e5f4575be 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionLdstrValidButChanged.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionLdstrValidButChanged.cs @@ -2,10 +2,6 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; namespace Mono.Linker.Tests.Cases.Reflection { - /// <summary> - /// We don't know if `typeName` will be changed or not. If we error on the side of caution and preserve something - /// that we found, I don't think that's a big deal - /// </summary> public class TypeUsedViaReflectionLdstrValidButChanged { public static void Main () { @@ -15,7 +11,6 @@ namespace Mono.Linker.Tests.Cases.Reflection { var typeKept = Type.GetType (typeName.Replace (replace, with), false); } - [Kept] public class Full { } } }
\ No newline at end of file |