diff options
author | Marek Safar <marek.safar@gmail.com> | 2020-07-10 14:26:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-10 14:26:34 +0300 |
commit | 104435b11c6f0947ce45e61520bf962fa5de15b4 (patch) | |
tree | 9458fd9a4759062d5d1dc9b063c51a392414c4d3 /test/Mono.Linker.Tests.Cases/DataFlow | |
parent | dae2b421104b08ff7d45565cd02c1d69735a71da (diff) |
Adds manual linker attributes removed for assembly and module level attributes (#1335)
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/DataFlow')
3 files changed, 54 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/AssemblyLevelLinkerAttributeRemoval.cs b/test/Mono.Linker.Tests.Cases/DataFlow/AssemblyLevelLinkerAttributeRemoval.cs new file mode 100644 index 000000000..da133fa35 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/DataFlow/AssemblyLevelLinkerAttributeRemoval.cs @@ -0,0 +1,26 @@ +// 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 Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Reflection; + +namespace Mono.Linker.Tests.Cases.DataFlow +{ + [SetupLinkAttributesFile ("AssemblyLevelLinkerAttributeRemoval.xml")] + [IgnoreLinkAttributes (false)] + + [SetupCompileBefore ("library.dll", new[] { "Dependencies/AssemblyLevelLinkerAttributeRemoval_Lib.cs" })] + + [RemovedTypeInAssembly ("library.dll", "Mono.Linker.Tests.Cases.TestAttributeLib.MyAttribute")] + class AssemblyLevelLinkerAttributeRemoval + { + public static void Main () + { + new Mono.Linker.Tests.Cases.TestAttributeLib.Foo (); + } + } +} diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/AssemblyLevelLinkerAttributeRemoval.xml b/test/Mono.Linker.Tests.Cases/DataFlow/AssemblyLevelLinkerAttributeRemoval.xml new file mode 100644 index 000000000..a9e2a798d --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/DataFlow/AssemblyLevelLinkerAttributeRemoval.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8" ?> +<linker> + <assembly fullname="*"> + <type fullname="Mono.Linker.Tests.Cases.TestAttributeLib.MyAttribute"> + <attribute internal="RemoveAttributeInstances"/> + </type> + </assembly> +</linker>
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/Dependencies/AssemblyLevelLinkerAttributeRemoval_Lib.cs b/test/Mono.Linker.Tests.Cases/DataFlow/Dependencies/AssemblyLevelLinkerAttributeRemoval_Lib.cs new file mode 100644 index 000000000..b4a08772a --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/DataFlow/Dependencies/AssemblyLevelLinkerAttributeRemoval_Lib.cs @@ -0,0 +1,20 @@ +using System; +using Mono.Linker.Tests.Cases.TestAttributeLib; + +[assembly: MyAttribute] +[module: MyAttribute] + +namespace Mono.Linker.Tests.Cases.TestAttributeLib +{ + [System.AttributeUsage (System.AttributeTargets.All, Inherited = false, AllowMultiple = true)] + public sealed class MyAttribute : System.Attribute + { + public MyAttribute () + { + } + } + + public class Foo + { + } +}
\ No newline at end of file |