diff options
author | Jackson Schuster <36744439+jtschuster@users.noreply.github.com> | 2022-02-04 23:05:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-04 23:05:06 +0300 |
commit | ecf202841ede1c390cbbe296889965dcb91a818e (patch) | |
tree | 0e3f2994b35d6cbe75c0dd2cb4c16c402df415f2 /test/Mono.Linker.Tests.Cases | |
parent | cdd4079a338a2d5a71c5334946d218c427a8869c (diff) |
Enable array arguments for custom attributes in xml and add array ctor for RemoveAttributeInstancesAttribute (#2516)
Diffstat (limited to 'test/Mono.Linker.Tests.Cases')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/LinkAttributes/LinkerAttributeRemovalConditional.cs | 54 | ||||
-rw-r--r-- | test/Mono.Linker.Tests.Cases/LinkAttributes/LinkerAttributeRemovalConditional.xml | 45 |
2 files changed, 98 insertions, 1 deletions
diff --git a/test/Mono.Linker.Tests.Cases/LinkAttributes/LinkerAttributeRemovalConditional.cs b/test/Mono.Linker.Tests.Cases/LinkAttributes/LinkerAttributeRemovalConditional.cs index 51c2ff1f4..2aa97cdc0 100644 --- a/test/Mono.Linker.Tests.Cases/LinkAttributes/LinkerAttributeRemovalConditional.cs +++ b/test/Mono.Linker.Tests.Cases/LinkAttributes/LinkerAttributeRemovalConditional.cs @@ -20,6 +20,12 @@ namespace Mono.Linker.Tests.Cases.LinkAttributes Removed_1 (); Removed_2 (); Removed_3 (); + Removed_4 (); + Kept_4 (); + Kept_5 (); + Removed_5 (); + Removed_6 (); + Kept_6 (); } [Kept] @@ -61,6 +67,45 @@ namespace Mono.Linker.Tests.Cases.LinkAttributes static void Removed_3 () { } + + [Kept] + [TestConditionalRemove ("remove2", "remove3")] + static void Removed_4 () + { + } + + [Kept] + [KeptAttributeAttribute (typeof (TestConditionalRemoveAttribute))] + [TestConditionalRemove ("remove2", "unmatched second arg")] + static void Kept_4 () + { + } + + [Kept] + [KeptAttributeAttribute (typeof (TestConditionalRemoveAttribute))] + [TestConditionalRemove ((int) 99, "remove3")] + static void Kept_5 () // Kept because int arg in constructor doesn't match long arg in xml + { + } + + [Kept] + [TestConditionalRemove (72, "a", "b", "c", "d", "e")] + static void Removed_5 () + { + } + + [Kept] + [TestConditionalRemove (new int[] { 1, 2, 3 }, "remove4")] + static void Removed_6 () + { + } + + [Kept] + [KeptAttributeAttribute (typeof (TestConditionalRemoveAttribute))] + [TestConditionalRemove (new int[] { 1, 2, 3, 4 }, "remove4")] + static void Kept_6 () + { + } } [Kept] @@ -90,5 +135,14 @@ namespace Mono.Linker.Tests.Cases.LinkAttributes public TestConditionalRemoveAttribute (int key, object value) { } + + public TestConditionalRemoveAttribute (int key, [KeptAttributeAttribute (typeof (ParamArrayAttribute))] params object[] values) + { + } + + [Kept] + public TestConditionalRemoveAttribute (int[] intArray, string str) + { + } } } diff --git a/test/Mono.Linker.Tests.Cases/LinkAttributes/LinkerAttributeRemovalConditional.xml b/test/Mono.Linker.Tests.Cases/LinkAttributes/LinkerAttributeRemovalConditional.xml index b89cfa186..b3b115a14 100644 --- a/test/Mono.Linker.Tests.Cases/LinkAttributes/LinkerAttributeRemovalConditional.xml +++ b/test/Mono.Linker.Tests.Cases/LinkAttributes/LinkerAttributeRemovalConditional.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8" ?> -<linker xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../src/ILLink.Shared/ILLink.LinkAttributes.xsd"> +<linker xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../src/ILLink.Shared/ILLink.LinkAttributes.xsd"> <assembly fullname="test"> <type fullname="Mono.Linker.Tests.Cases.LinkAttributes.TestConditionalRemoveAttribute"> <attribute internal="RemoveAttributeInstances"> @@ -21,6 +21,49 @@ <argument>remove0</argument> </argument> </attribute> + <attribute internal="RemoveAttributeInstances"> + <argument type="System.Object[]"> + <argument type="System.String">remove2</argument> + <argument type="System.String">remove3</argument> + </argument> + </attribute> + <attribute internal="RemoveAttributeInstances"> + <argument type="System.Object[]"> + <argument type="System.Object"> + <argument type="System.Int64">99</argument> + </argument> + <argument type="System.Object"> + <argument type="System.String">remove3</argument> + </argument> + </argument> + </attribute> + </type> + <type fullname="Mono.Linker.Tests.Cases.LinkAttributes.TestConditionalRemoveAttribute"> + <attribute internal="RemoveAttributeInstances"> + <argument type="System.Object[]"> + <argument type="System.Object"> + <argument type="System.Int32">72</argument> + </argument> + <argument type="System.Object"> + <argument type="System.String[]"> + <argument type="System.String">a</argument> + <argument type="System.String">b</argument> + <argument type="System.String">c</argument> + <argument type="System.String">d</argument> + <argument type="System.String">e</argument> + </argument> + </argument> + </argument> + </attribute> + <attribute internal="RemoveAttributeInstances"> + <argument type="System.Object"> + <argument type="System.Int32[]"> + <argument type="System.Int32">1</argument> + <argument type="System.Int32">2</argument> + <argument type="System.Int32">3</argument> + </argument> + </argument> + </attribute> </type> </assembly> </linker> |