diff options
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs new file mode 100644 index 000000000..1fcef6673 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs @@ -0,0 +1,161 @@ +using System; +using System.Diagnostics; +using System.Reflection; +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.Reflection { + public class TypeUsedViaReflection { + public static void Main () + { + TestNull (); + TestEmptyString (); + TestFullString (); + TestGenericString (); + TestFullStringConst(); + TestTypeAsmName (); + TestType (); + TestPointer (); + TestReference (); + TestArray (); + TestArrayOfArray (); + TestMultiDimensionalArray (); + TestMultiDimensionalArrayFullString (); + TestMultiDimensionalArrayAsmName (); + } + + [Kept] + public static void TestNull () + { + string reflectionTypeKeptString = null; + var typeKept = Type.GetType (reflectionTypeKeptString, false); + } + + [Kept] + public static void TestEmptyString () + { + string reflectionTypeKeptString = ""; + var typeKept = Type.GetType (reflectionTypeKeptString, false); + } + + [Kept] + public class Full { } + + [Kept] + public static void TestFullString () + { + var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+Full, test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"; + var typeKept = Type.GetType (reflectionTypeKeptString, false); + } + + [Kept] + public class Generic<T> { } + + [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"; + var typeKept = Type.GetType (reflectionTypeKeptString, false); + } + + [Kept] + public class FullConst { } + + [Kept] + public static void TestFullStringConst() + { + const string reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+FullConst, test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"; + var typeKept = Type.GetType(reflectionTypeKeptString, false); + } + + [Kept] + public class TypeAsmName { } + + [Kept] + public static void TestTypeAsmName () + { + var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+TypeAsmName, test"; + var typeKept = Type.GetType (reflectionTypeKeptString, false); + } + + [Kept] + public class AType { } + + [Kept] + public static void TestType () + { + var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+AType"; + var typeKept = Type.GetType (reflectionTypeKeptString, false); + } + + [Kept] + public class Pointer { } + + [Kept] + public static void TestPointer () + { + var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+Pointer*"; + var typeKept = Type.GetType (reflectionTypeKeptString, false); + } + + [Kept] + public class Reference { } + + [Kept] + public static void TestReference () + { + var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+Reference&"; + var typeKept = Type.GetType (reflectionTypeKeptString, false); + } + + [Kept] + public class Array { } + + [Kept] + public static void TestArray () + { + var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+Array[]"; + var typeKept = Type.GetType (reflectionTypeKeptString, false); + } + + [Kept] + public class ArrayOfArray{ } + + [Kept] + public static void TestArrayOfArray () + { + var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+ArrayOfArray[][]"; + var typeKept = Type.GetType (reflectionTypeKeptString, false); + } + + + [Kept] + public class MultiDimensionalArray{ } + + [Kept] + public static void TestMultiDimensionalArray () + { + var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+MultiDimensionalArray[,]"; + var typeKept = Type.GetType (reflectionTypeKeptString, false); + } + + [Kept] + public class MultiDimensionalArrayFullString { } + + [Kept] + public static void TestMultiDimensionalArrayFullString () + { + var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+MultiDimensionalArrayFullString[,], test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"; + var typeKept = Type.GetType (reflectionTypeKeptString, false); + } + + [Kept] + public class MultiDimensionalArrayAsmName { } + + [Kept] + public static void TestMultiDimensionalArrayAsmName () + { + var reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+MultiDimensionalArrayAsmName[,], test"; + var typeKept = Type.GetType (reflectionTypeKeptString, false); + } + } +} |