Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/linker
diff options
context:
space:
mode:
authorMike Voorhees <michaelv@unity3d.com>2017-05-31 17:00:43 +0300
committerMarek Safar <marek.safar@gmail.com>2017-05-31 19:28:47 +0300
commit392310da518785c1ed177bbd118780ef89aaa946 (patch)
treeeb9c70474f0dc53c9ad48e6341f82f338a8194bd /linker
parent65fd2098ffb981b3162da4399ae07b90306c5270 (diff)
Add some tests for situation where interface method is removed
Diffstat (limited to 'linker')
-rw-r--r--linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj3
-rw-r--r--linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs26
-rw-r--r--linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromInterfaceHasInterfaceMethodKept.cs27
-rw-r--r--linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs26
4 files changed, 82 insertions, 0 deletions
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 ba81df75d..0055c2991 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
@@ -57,6 +57,9 @@
<Compile Include="Basic\UnusedPropertySetterRemoved.cs" />
<Compile Include="Basic\UsedPropertyIsKept.cs" />
<Compile Include="Basic\UsedStructIsKept.cs" />
+ <Compile Include="VirtualMethods\ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs" />
+ <Compile Include="VirtualMethods\ClassUsedFromInterfaceHasInterfaceMethodKept.cs" />
+ <Compile Include="VirtualMethods\StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs" />
<Compile Include="VirtualMethods\StructUsedFromInterfaceHasInterfaceMethodKept.cs" />
<Compile Include="CoreLink\CopyOfCoreLibrariesKeepsUnusedTypes.cs" />
<Compile Include="CoreLink\LinkingOfCoreLibrariesRemovesUnusedMethods.cs" />
diff --git a/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs b/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs
new file mode 100644
index 000000000..51ea017d7
--- /dev/null
+++ b/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs
@@ -0,0 +1,26 @@
+using Mono.Linker.Tests.Cases.Expectations.Assertions;
+
+namespace Mono.Linker.Tests.Cases.VirtualMethods
+{
+ class ClassUsedFromConcreteTypeHasInterfaceMethodRemoved {
+ public static void Main ()
+ {
+ A a = new A ();
+ a.Foo ();
+ }
+
+ [Kept]
+ [KeptInterface (typeof (IFoo))]
+ struct A : IFoo {
+ [Kept]
+ public void Foo ()
+ {
+ }
+ }
+
+ [Kept]
+ public interface IFoo {
+ void Foo ();
+ }
+ }
+}
diff --git a/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromInterfaceHasInterfaceMethodKept.cs b/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromInterfaceHasInterfaceMethodKept.cs
new file mode 100644
index 000000000..0f32024a3
--- /dev/null
+++ b/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromInterfaceHasInterfaceMethodKept.cs
@@ -0,0 +1,27 @@
+using Mono.Linker.Tests.Cases.Expectations.Assertions;
+
+namespace Mono.Linker.Tests.Cases.VirtualMethods
+{
+ class ClassUsedFromInterfaceHasInterfaceMethodKept {
+ public static void Main ()
+ {
+ IFoo a = new A ();
+ a.Foo ();
+ }
+
+ [Kept]
+ [KeptInterface (typeof (IFoo))]
+ struct A : IFoo {
+ [Kept]
+ public void Foo ()
+ {
+ }
+ }
+
+ [Kept]
+ public interface IFoo {
+ [Kept]
+ void Foo ();
+ }
+ }
+}
diff --git a/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs b/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs
new file mode 100644
index 000000000..bb795599d
--- /dev/null
+++ b/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs
@@ -0,0 +1,26 @@
+using Mono.Linker.Tests.Cases.Expectations.Assertions;
+
+namespace Mono.Linker.Tests.Cases.VirtualMethods
+{
+ class StructUsedFromConcreteTypeHasInterfaceMethodRemoved {
+ public static void Main ()
+ {
+ A a = new A ();
+ a.Foo ();
+ }
+
+ [Kept]
+ [KeptInterface (typeof (IFoo))]
+ struct A : IFoo {
+ [Kept]
+ public void Foo ()
+ {
+ }
+ }
+
+ [Kept]
+ public interface IFoo {
+ void Foo ();
+ }
+ }
+}