diff options
author | Marek Safar <marek.safar@gmail.com> | 2017-05-09 17:50:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-09 17:50:55 +0300 |
commit | e3c3100f21b4afdcd5180d1c1dc61d24f1e09931 (patch) | |
tree | a500b72fdd0541253c5a4923fa26eb53ade4283d /linker/Tests/Mono.Linker.Tests.Cases.Expectations | |
parent | e4dfcf006b0705aba6b204aab2d603b781c5fc44 (diff) |
Test framework (#101)
Diffstat (limited to 'linker/Tests/Mono.Linker.Tests.Cases.Expectations')
16 files changed, 256 insertions, 0 deletions
diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseExpectedLinkedBehaviorAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseExpectedLinkedBehaviorAttribute.cs new file mode 100644 index 000000000..47f0f3415 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseExpectedLinkedBehaviorAttribute.cs @@ -0,0 +1,11 @@ +using System; +using System.Diagnostics; + +namespace Mono.Linker.Tests.Cases.Expectations.Assertions { + /// <summary> + /// Base attribute for attributes that mark up the expected behavior of the linker on a member + /// </summary> + [Conditional("INCLUDE_EXPECTATIONS")] + public abstract class BaseExpectedLinkedBehaviorAttribute : Attribute { + } +}
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/IgnoreTestCaseAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/IgnoreTestCaseAttribute.cs new file mode 100644 index 000000000..9d3cfacc7 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/IgnoreTestCaseAttribute.cs @@ -0,0 +1,13 @@ +using System; + +namespace Mono.Linker.Tests.Cases.Expectations.Assertions { + [AttributeUsage (AttributeTargets.Class)] + public class IgnoreTestCaseAttribute : Attribute { + public readonly string Reason; + + public IgnoreTestCaseAttribute (string reason) + { + Reason = reason; + } + } +}
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAssemblyAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAssemblyAttribute.cs new file mode 100644 index 000000000..086304179 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAssemblyAttribute.cs @@ -0,0 +1,16 @@ +using System; + +namespace Mono.Linker.Tests.Cases.Expectations.Assertions { + /// <summary> + /// Verifies that an assembly does exist in the output directory + /// </summary> + [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] + public class KeptAssemblyAttribute : KeptAttribute { + public readonly string FileName; + + public KeptAssemblyAttribute (string fileName) + { + FileName = fileName; + } + } +}
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttribute.cs new file mode 100644 index 000000000..837c97152 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttribute.cs @@ -0,0 +1,7 @@ +using System; + +namespace Mono.Linker.Tests.Cases.Expectations.Assertions { + [AttributeUsage (AttributeTargets.All, Inherited = false)] + public class KeptAttribute : BaseExpectedLinkedBehaviorAttribute { + } +}
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeAttribute.cs new file mode 100644 index 000000000..c183e62d2 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeAttribute.cs @@ -0,0 +1,15 @@ +using System; + +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ + [AttributeUsage (AttributeTargets.All, AllowMultiple = true, Inherited = false)] + public class KeptAttributeAttribute : KeptAttribute + { + public readonly string AttributeName; + + public KeptAttributeAttribute (string attributeName) + { + AttributeName = attributeName; + } + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBackingFieldAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBackingFieldAttribute.cs new file mode 100644 index 000000000..a4160490a --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBackingFieldAttribute.cs @@ -0,0 +1,8 @@ +using System; + +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ + [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)] + public sealed class KeptBackingFieldAttribute : KeptAttribute { + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBaseTypeAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBaseTypeAttribute.cs new file mode 100644 index 000000000..ff1f2fa84 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBaseTypeAttribute.cs @@ -0,0 +1,22 @@ +using System; + +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ + [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] + public sealed class KeptBaseTypeAttribute : KeptAttribute + { + public readonly Type BaseType; + public readonly object [] GenericParameterNames; + + public KeptBaseTypeAttribute (Type baseType) + { + BaseType = baseType; + } + + public KeptBaseTypeAttribute (Type baseType, params object[] typeArguments) + { + BaseType = baseType; + GenericParameterNames = typeArguments; + } + } +}
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceAttribute.cs new file mode 100644 index 000000000..5014bd23a --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceAttribute.cs @@ -0,0 +1,16 @@ +using System; +using System.Diagnostics; + +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ + [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] + public class KeptInterfaceAttribute : KeptAttribute + { + public readonly Type InterfaceType; + + public KeptInterfaceAttribute (Type interfaceType) + { + InterfaceType = interfaceType; + } + } +}
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberAttribute.cs new file mode 100644 index 000000000..00e55f266 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberAttribute.cs @@ -0,0 +1,13 @@ +using System; + +namespace Mono.Linker.Tests.Cases.Expectations.Assertions { + [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] + public sealed class KeptMemberAttribute : KeptAttribute { + public readonly string Name; + + public KeptMemberAttribute (string name) + { + Name = name; + } + } +}
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAssemblyAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAssemblyAttribute.cs new file mode 100644 index 000000000..4bb6a320a --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAssemblyAttribute.cs @@ -0,0 +1,16 @@ +using System; + +namespace Mono.Linker.Tests.Cases.Expectations.Assertions { + /// <summary> + /// Verifies that an assembly does not exist in the output directory + /// </summary> + [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] + public class RemovedAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute { + public readonly string FileName; + + public RemovedAssemblyAttribute (string fileName) + { + FileName = fileName; + } + } +}
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/BaseMetadataAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/BaseMetadataAttribute.cs new file mode 100644 index 000000000..d98584eab --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/BaseMetadataAttribute.cs @@ -0,0 +1,9 @@ +using System; +using System.Diagnostics; + +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ + [Conditional("INCLUDE_EXPECTATIONS")] + public abstract class BaseMetadataAttribute : Attribute { + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/CoreLinkAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/CoreLinkAttribute.cs new file mode 100644 index 000000000..7529a6255 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/CoreLinkAttribute.cs @@ -0,0 +1,13 @@ +using System; + +namespace Mono.Linker.Tests.Cases.Expectations.Metadata { + [AttributeUsage (AttributeTargets.Class)] + public class CoreLinkAttribute : BaseMetadataAttribute { + public readonly string Value; + + public CoreLinkAttribute (string value) + { + Value = value; + } + } +}
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/NotATestCaseAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/NotATestCaseAttribute.cs new file mode 100644 index 000000000..11cd069c3 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/NotATestCaseAttribute.cs @@ -0,0 +1,7 @@ +using System; + +namespace Mono.Linker.Tests.Cases.Expectations.Metadata { + [AttributeUsage (AttributeTargets.Class)] + public class NotATestCaseAttribute : BaseMetadataAttribute { + } +}
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs new file mode 100644 index 000000000..0a37a2149 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs @@ -0,0 +1,13 @@ +using System; + +namespace Mono.Linker.Tests.Cases.Expectations.Metadata { + [AttributeUsage (AttributeTargets.Class)] + public class ReferenceAttribute : BaseMetadataAttribute { + public readonly string Value; + + public ReferenceAttribute (string value) + { + Value = value; + } + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SandboxDependencyAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SandboxDependencyAttribute.cs new file mode 100644 index 000000000..805b1ac56 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SandboxDependencyAttribute.cs @@ -0,0 +1,13 @@ +using System; + +namespace Mono.Linker.Tests.Cases.Expectations.Metadata { + [AttributeUsage (AttributeTargets.Class)] + public class SandboxDependencyAttribute : BaseMetadataAttribute { + public readonly string RelativePathToFile; + + public SandboxDependencyAttribute (string relativePathToFile) + { + RelativePathToFile = relativePathToFile; + } + } +}
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj new file mode 100644 index 000000000..dfb15ba2a --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{2C26601F-3E2F-45B9-A02F-58EE9296E19E}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Mono.Linker.Tests.Cases.Expectations</RootNamespace> + <AssemblyName>Mono.Linker.Tests.Cases.Expectations</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Assertions\IgnoreTestCaseAttribute.cs" /> + <Compile Include="Assertions\KeptAssemblyAttribute.cs" /> + <Compile Include="Assertions\KeptAttribute.cs" /> + <Compile Include="Assertions\BaseExpectedLinkedBehaviorAttribute.cs" /> + <Compile Include="Assertions\KeptBackingFieldAttribute.cs" /> + <Compile Include="Assertions\KeptMemberAttribute.cs" /> + <Compile Include="Assertions\RemovedAssemblyAttribute.cs" /> + <Compile Include="Metadata\BaseMetadataAttribute.cs" /> + <Compile Include="Metadata\CoreLinkAttribute.cs" /> + <Compile Include="Metadata\NotATestCaseAttribute.cs" /> + <Compile Include="Metadata\ReferenceAttribute.cs" /> + <Compile Include="Metadata\SandboxDependencyAttribute.cs" /> + <Compile Include="Assertions\KeptBaseTypeAttribute.cs" /> + <Compile Include="Assertions\KeptInterfaceAttribute.cs" /> + <Compile Include="Assertions\KeptAttributeAttribute.cs" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file |