diff options
author | Michael Voorhees <michaelv@unity3d.com> | 2020-09-11 21:34:47 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2020-09-16 16:17:07 +0300 |
commit | 78e35797f5b1b0b1df0aa25111f6574291d8deb0 (patch) | |
tree | a75bae941b829b4a3dfcea005bf40b2df8cc4ac8 /test/Mono.Linker.Tests.Cases/DataFlow | |
parent | 89db00569a266d6b1cfd05611b500eb13fea3ce5 (diff) |
Add tests to enforcement test framework rules and conventions.
* Add a unit test to verify a type can be found for every test case cs file.
* Add a test to verify that the Expectations assembly only contains types used for annotating test cases and is not used as a home for common test case helper code.
* Move `TestSystemTypeBase` to the test cases assembly. This is helper code and should not be in the Expectations assembly.
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/DataFlow')
3 files changed, 169 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/Dependencies/TestSystemTypeBase.cs b/test/Mono.Linker.Tests.Cases/DataFlow/Dependencies/TestSystemTypeBase.cs new file mode 100644 index 000000000..c1a90a423 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/DataFlow/Dependencies/TestSystemTypeBase.cs @@ -0,0 +1,165 @@ +// 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.Globalization; +using System.Reflection; + +namespace System +{ + public class TestSystemTypeBase : Type + { + public override Assembly Assembly => throw new NotImplementedException (); + + public override string AssemblyQualifiedName => throw new NotImplementedException (); + + public override Type BaseType => throw new NotImplementedException (); + + public override string FullName => throw new NotImplementedException (); + + public override Guid GUID => throw new NotImplementedException (); + + public override Module Module => throw new NotImplementedException (); + + public override string Namespace => throw new NotImplementedException (); + + public override Type UnderlyingSystemType => throw new NotImplementedException (); + + public override string Name => throw new NotImplementedException (); + + public override ConstructorInfo[] GetConstructors (BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + public override object[] GetCustomAttributes (bool inherit) + { + throw new NotImplementedException (); + } + + public override object[] GetCustomAttributes (Type attributeType, bool inherit) + { + throw new NotImplementedException (); + } + + public override Type GetElementType () + { + throw new NotImplementedException (); + } + + public override EventInfo GetEvent (string name, BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + public override EventInfo[] GetEvents (BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + public override FieldInfo GetField (string name, BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + public override FieldInfo[] GetFields (BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + public override Type GetInterface (string name, bool ignoreCase) + { + throw new NotImplementedException (); + } + + public override Type[] GetInterfaces () + { + throw new NotImplementedException (); + } + + public override MemberInfo[] GetMembers (BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + public override MethodInfo[] GetMethods (BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + public override Type GetNestedType (string name, BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + public override Type[] GetNestedTypes (BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + public override PropertyInfo[] GetProperties (BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + public override object InvokeMember (string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) + { + throw new NotImplementedException (); + } + + public override bool IsDefined (Type attributeType, bool inherit) + { + throw new NotImplementedException (); + } + + protected override TypeAttributes GetAttributeFlagsImpl () + { + throw new NotImplementedException (); + } + + protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) + { + throw new NotImplementedException (); + } + + protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) + { + throw new NotImplementedException (); + } + + protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) + { + throw new NotImplementedException (); + } + + protected override bool HasElementTypeImpl () + { + throw new NotImplementedException (); + } + + protected override bool IsArrayImpl () + { + throw new NotImplementedException (); + } + + protected override bool IsByRefImpl () + { + throw new NotImplementedException (); + } + + protected override bool IsCOMObjectImpl () + { + throw new NotImplementedException (); + } + + protected override bool IsPointerImpl () + { + throw new NotImplementedException (); + } + + protected override bool IsPrimitiveImpl () + { + throw new NotImplementedException (); + } + } +}
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs index e04fb56e1..3a8fbe1ef 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs @@ -9,10 +9,12 @@ using System.Globalization; using System.Reflection; using System.Text; using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.DataFlow { [SkipKeptItemsValidation] + [SandboxDependency ("Dependencies/TestSystemTypeBase.cs")] public class MethodThisDataFlow { public static void Main () diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs b/test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs index d28d2c815..46801b241 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs @@ -7,10 +7,12 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Text; using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.DataFlow { [SkipKeptItemsValidation] + [SandboxDependency ("Dependencies/TestSystemTypeBase.cs")] class VirtualMethodHierarchyDataflowAnnotationValidation { public static void Main () |