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
diff options
context:
space:
mode:
authorMike Voorhees <mrvoorhe@users.noreply.github.com>2020-09-11 11:55:20 +0300
committerGitHub <noreply@github.com>2020-09-11 11:55:20 +0300
commitd0e1175e94367dc5c0871fb51a3ee11e6e9004a4 (patch)
treee95e44dffb218b3475a5cd33b2148f110e09d340 /test/Mono.Linker.Tests.Cases
parent4f11a35ee8ad2bb16e9d66091023891cd31a0a73 (diff)
Fix some tests (#1481)
Every test .cs file must be able to resolve a type of the same name during test execution. Otherwise it triggers a warning and if warnings ever accumulate it becomes impossible to notice when you have a test type name that doesn't match the file name The rule of thumb to follow is, never #if out the test case type definition. Include an ignore and and exclude any code that can't compile. * Fix `DebuggerDisplayAttributeOnTypeCopy` only existing when `NETCOREAPP` is defined. I just removed the define. I don't see why it wouldn't work on .NET Framework * Fix `DefaultInterfaceMethodCallIntoClass` only existing when `NETCOREAPP` is defined. I most of the test is #if away when not `NETCOREAPP` app and an `[IgnoreTestCase]` is included * Fix `GenericDefaultInterfaceMethods` only existing when `NETCOREAPP` is defined. I most of the test is #if away when not `NETCOREAPP` app and an `[IgnoreTestCase]` is included * Fix `SimpleDefaultInterfaceMethod` only existing when `NETCOREAPP` is defined. I most of the test is #if away when not `NETCOREAPP` app and an `[IgnoreTestCase]` is included * Fix `UnusedDefaultInterfaceImplementation` only existing when `NETCOREAPP` is defined. I most of the test is #if away when not `NETCOREAPP` app and an `[IgnoreTestCase]` is included * Fix `AttributeScopeUpdated`. The type name did not match the file name.
Diffstat (limited to 'test/Mono.Linker.Tests.Cases')
-rw-r--r--test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeCopy.cs5
-rw-r--r--test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/DefaultInterfaceMethodCallIntoClass.cs9
-rw-r--r--test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/GenericDefaultInterfaceMethods.cs9
-rw-r--r--test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/SimpleDefaultInterfaceMethod.cs9
-rw-r--r--test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/UnusedDefaultInterfaceImplementation.cs9
-rw-r--r--test/Mono.Linker.Tests.Cases/TypeForwarding/AttributesScopeUpdated.cs7
6 files changed, 33 insertions, 15 deletions
diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeCopy.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeCopy.cs
index 174894e50..a3c6ee987 100644
--- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeCopy.cs
+++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeCopy.cs
@@ -1,6 +1,4 @@
-#if NETCOREAPP
-
-using System.Diagnostics;
+using System.Diagnostics;
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;
@@ -41,4 +39,3 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger
}
}
}
-#endif
diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/DefaultInterfaceMethodCallIntoClass.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/DefaultInterfaceMethodCallIntoClass.cs
index 111d2dde7..c5e8e3ee7 100644
--- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/DefaultInterfaceMethodCallIntoClass.cs
+++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/DefaultInterfaceMethodCallIntoClass.cs
@@ -6,14 +6,19 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata;
namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.DefaultInterfaceMethods
{
-#if NETCOREAPP
+#if !NETCOREAPP
+ [IgnoreTestCase ("Requires support for default interface methods")]
+#endif
class DefaultInterfaceMethodCallIntoClass
{
public static void Main ()
{
+#if NETCOREAPP
((IBase) new Derived ()).Frob ();
+#endif
}
+#if NETCOREAPP
[Kept]
interface IBase
{
@@ -46,6 +51,6 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.DefaultInterfaceMethods
[Kept]
public void Actual () { }
}
- }
#endif
+ }
}
diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/GenericDefaultInterfaceMethods.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/GenericDefaultInterfaceMethods.cs
index 1660980a8..6e4d6f1ab 100644
--- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/GenericDefaultInterfaceMethods.cs
+++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/GenericDefaultInterfaceMethods.cs
@@ -5,15 +5,20 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions;
namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.DefaultInterfaceMethods
{
-#if NETCOREAPP
+#if !NETCOREAPP
+ [IgnoreTestCase ("Requires support for default interface methods")]
+#endif
class GenericDefaultInterfaceMethods
{
public static void Main ()
{
+#if NETCOREAPP
((IFoo<int>) new Bar ()).Method (12);
((IFoo<int>) new Baz ()).Method (12);
+#endif
}
+#if NETCOREAPP
[Kept]
interface IFoo<T>
{
@@ -61,6 +66,6 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.DefaultInterfaceMethods
{
}
}
- }
#endif
+ }
}
diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/SimpleDefaultInterfaceMethod.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/SimpleDefaultInterfaceMethod.cs
index bac1df652..7838085d3 100644
--- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/SimpleDefaultInterfaceMethod.cs
+++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/SimpleDefaultInterfaceMethod.cs
@@ -6,14 +6,19 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata;
namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.DefaultInterfaceMethods
{
-#if NETCOREAPP
+#if !NETCOREAPP
+ [IgnoreTestCase ("Requires support for default interface methods")]
+#endif
class SimpleDefaultInterfaceMethod
{
public static void Main ()
{
+#if NETCOREAPP
((IBasic) new Basic ()).DoSomething ();
+#endif
}
+#if NETCOREAPP
[Kept]
interface IBasic
{
@@ -51,6 +56,6 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.DefaultInterfaceMethods
[Kept]
public Basic () { }
}
- }
#endif
+ }
}
diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/UnusedDefaultInterfaceImplementation.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/UnusedDefaultInterfaceImplementation.cs
index b882c4388..15114d3c5 100644
--- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/UnusedDefaultInterfaceImplementation.cs
+++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/UnusedDefaultInterfaceImplementation.cs
@@ -5,14 +5,19 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions;
namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.DefaultInterfaceMethods
{
-#if NETCOREAPP
+#if !NETCOREAPP
+ [IgnoreTestCase ("Requires support for default interface methods")]
+#endif
class UnusedDefaultInterfaceImplementation
{
public static void Main ()
{
+#if NETCOREAPP
((IFoo) new Foo ()).InterfaceMethod ();
+#endif
}
+#if NETCOREAPP
[Kept]
interface IFoo
{
@@ -39,6 +44,6 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.DefaultInterfaceMethods
{
}
}
- }
#endif
+ }
}
diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributesScopeUpdated.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributesScopeUpdated.cs
index d9fdf913f..233f4f5ec 100644
--- a/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributesScopeUpdated.cs
+++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributesScopeUpdated.cs
@@ -21,23 +21,24 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding
[RemovedAssembly ("Forwarder.dll")]
[KeptMemberInAssembly ("Implementation.dll", typeof (ImplementationLibrary))]
- static class AttributeScopeUpdated
+ static class AttributesScopeUpdated
{
static void Main ()
{
}
[Kept]
- public static void Test_1 ([TestType3 (typeof (ImplementationLibrary))] int arg)
+ public static void Test_1 ([KeptAttributeAttribute (typeof (TestType3Attribute))] [TestType3 (typeof (ImplementationLibrary))] int arg)
{
}
[Kept]
- public static void Test_2<[TestType3 (typeof (ImplementationLibrary))] T> ()
+ public static void Test_2<[KeptAttributeAttribute (typeof (TestType3Attribute))] [TestType3 (typeof (ImplementationLibrary))] T> ()
{
}
[Kept]
+ [return: KeptAttributeAttribute (typeof (TestType3Attribute))]
[return: TestType3 (typeof (ImplementationLibrary))]
public static void Test_3 ()
{