diff options
author | Mike Voorhees <michaelv@unity3d.com> | 2017-05-11 02:39:12 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2017-05-11 20:13:28 +0300 |
commit | cbb4fe809fab5684ecb5302ae1f01a28db418f42 (patch) | |
tree | 2f3cfe06b3b339aa49f356a9e8edbe45ecd02a74 /linker | |
parent | c2bd71d57a62f36a04296f02ea2c48ad08473e1b (diff) |
Add tests for ComImport cases
Diffstat (limited to 'linker')
11 files changed, 238 insertions, 0 deletions
diff --git a/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfParameterIsRemoved.cs b/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfParameterIsRemoved.cs new file mode 100644 index 000000000..a75bed14a --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfParameterIsRemoved.cs @@ -0,0 +1,22 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { + class DefaultConstructorOfParameterIsRemoved { + public static void Main () + { + SomeMethod (null); + } + + [Kept] + [ComImport] + [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] + class A { + } + + [Kept] + [MethodImpl (MethodImplOptions.InternalCall)] + static extern void SomeMethod (A val); + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfReturnTypeIsRemoved.cs b/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfReturnTypeIsRemoved.cs new file mode 100644 index 000000000..a0bee8d72 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfReturnTypeIsRemoved.cs @@ -0,0 +1,22 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { + class DefaultConstructorOfReturnTypeIsRemoved { + public static void Main () + { + var a = SomeMethod (); + } + + [Kept] + [ComImport] + [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] + class A { + } + + [Kept] + [MethodImpl (MethodImplOptions.InternalCall)] + static extern A SomeMethod (); + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfParameterAreRemoved.cs b/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfParameterAreRemoved.cs new file mode 100644 index 000000000..afe98aaca --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfParameterAreRemoved.cs @@ -0,0 +1,23 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { + class FieldsOfParameterAreRemoved { + public static void Main () + { + SomeMethod (null); + } + + [Kept] + [ComImport] + [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] + class A { + private int field; + } + + [Kept] + [MethodImpl (MethodImplOptions.InternalCall)] + static extern void SomeMethod (A val); + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfReturnTypeAreRemoved.cs b/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfReturnTypeAreRemoved.cs new file mode 100644 index 000000000..1447fc6aa --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfReturnTypeAreRemoved.cs @@ -0,0 +1,23 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { + class FieldsOfReturnTypeAreRemoved { + public static void Main () + { + var a = SomeMethod (); + } + + [Kept] + [ComImport] + [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] + class A { + private int field; + } + + [Kept] + [MethodImpl (MethodImplOptions.InternalCall)] + static extern A SomeMethod (); + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfThisAreRemoved.cs b/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfThisAreRemoved.cs new file mode 100644 index 000000000..272c5d879 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfThisAreRemoved.cs @@ -0,0 +1,24 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { + class FieldsOfThisAreRemoved { + public static void Main () + { + new A ().SomeMethod (); + } + + [Kept] + [KeptMember (".ctor()")] + [ComImport] + [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] + class A { + private int field; + + [Kept] + [MethodImpl (MethodImplOptions.InternalCall)] + public extern void SomeMethod (); + } + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfParameterIsRemoved.cs b/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfParameterIsRemoved.cs new file mode 100644 index 000000000..a22fb03e1 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfParameterIsRemoved.cs @@ -0,0 +1,22 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { + class DefaultConstructorOfParameterIsRemoved { + public static void Main () + { + SomeMethod (null); + } + + [Kept] + [ComImport] + [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] + class A { + } + + [Kept] + [MethodImpl (MethodImplOptions.InternalCall)] + static extern void SomeMethod (A val); + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfReturnTypeIsRemoved.cs b/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfReturnTypeIsRemoved.cs new file mode 100644 index 000000000..7e4356285 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfReturnTypeIsRemoved.cs @@ -0,0 +1,22 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { + class DefaultConstructorOfReturnTypeIsRemoved { + public static void Main () + { + var a = SomeMethod (); + } + + [Kept] + [ComImport] + [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] + class A { + } + + [Kept] + [MethodImpl (MethodImplOptions.InternalCall)] + static extern A SomeMethod (); + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfParameterAreRemoved.cs b/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfParameterAreRemoved.cs new file mode 100644 index 000000000..e0a1839e2 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfParameterAreRemoved.cs @@ -0,0 +1,23 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { + class FieldsOfParameterAreRemoved { + public static void Main () + { + SomeMethod (null); + } + + [Kept] + [ComImport] + [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] + class A { + private int field; + } + + [Kept] + [MethodImpl (MethodImplOptions.InternalCall)] + static extern void SomeMethod (A val); + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfReturnTypeAreRemoved.cs b/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfReturnTypeAreRemoved.cs new file mode 100644 index 000000000..7b6741bd2 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfReturnTypeAreRemoved.cs @@ -0,0 +1,23 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { + class FieldsOfReturnTypeAreRemoved { + public static void Main () + { + var a = SomeMethod (); + } + + [Kept] + [ComImport] + [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] + class A { + private int field; + } + + [Kept] + [MethodImpl (MethodImplOptions.InternalCall)] + static extern A SomeMethod (); + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfThisAreRemoved.cs b/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfThisAreRemoved.cs new file mode 100644 index 000000000..a4453338a --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfThisAreRemoved.cs @@ -0,0 +1,24 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { + class FieldsOfThisAreRemoved { + public static void Main () + { + new A ().SomeMethod (); + } + + [Kept] + [KeptMember (".ctor()")] + [ComImport] + [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] + class A { + private int field; + + [Kept] + [MethodImpl (MethodImplOptions.InternalCall)] + public extern void SomeMethod (); + } + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj b/linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj index 245bc0936..49463ed70 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj +++ b/linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj @@ -66,7 +66,17 @@ <Compile Include="Generics\MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameterNestedCase.cs" /> <Compile Include="Generics\MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameterNestedCase2.cs" /> <Compile Include="Generics\OverrideWithAnotherVirtualMethodOfSameNameWithDifferentParameterType.cs" /> + <Compile Include="Interop\InternalCalls\Com\DefaultConstructorOfParameterIsRemoved.cs" /> + <Compile Include="Interop\InternalCalls\Com\FieldsOfParameterAreRemoved.cs" /> + <Compile Include="Interop\InternalCalls\Com\FieldsOfReturnTypeAreRemoved.cs" /> + <Compile Include="Interop\InternalCalls\Com\FieldsOfThisAreRemoved.cs" /> <Compile Include="Interop\InternalCalls\DefaultConstructorOfReturnTypeIsNotRemoved.cs" /> + <Compile Include="Interop\InternalCalls\Com\DefaultConstructorOfReturnTypeIsRemoved.cs" /> + <Compile Include="Interop\PInvoke\Com\DefaultConstructorOfParameterIsRemoved.cs" /> + <Compile Include="Interop\PInvoke\Com\DefaultConstructorOfReturnTypeIsRemoved.cs" /> + <Compile Include="Interop\PInvoke\Com\FieldsOfParameterAreRemoved.cs" /> + <Compile Include="Interop\PInvoke\Com\FieldsOfReturnTypeAreRemoved.cs" /> + <Compile Include="Interop\PInvoke\Com\FieldsOfThisAreRemoved.cs" /> <Compile Include="Interop\PInvoke\DefaultConstructorOfReturnTypeIsNotRemoved.cs" /> <Compile Include="Interop\InternalCalls\UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs" /> <Compile Include="Interop\PInvoke\UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs" /> |