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/test
diff options
context:
space:
mode:
authorVitek Karas <10670590+vitek-karas@users.noreply.github.com>2022-05-24 14:06:39 +0300
committerGitHub <noreply@github.com>2022-05-24 14:06:39 +0300
commit9a0495d2e99d4bf08695a958df7d06061c559fab (patch)
tree4b68f20dbd2799b62f5956f1f83ddb98544fd709 /test
parent254361896325fa94b103187e35af99794efa2f57 (diff)
Better tests for attribute dataflow (#2804)
Use RUC warnings to validate correct marking caused by attribute data flow. The analyzer side of these tests doesn't work yet as they use string->type marking and the analyzer is missing a type name parser for now.
Diffstat (limited to 'test')
-rw-r--r--test/Mono.Linker.Tests.Cases/DataFlow/AttributeConstructorDataflow.cs4
-rw-r--r--test/Mono.Linker.Tests.Cases/DataFlow/AttributeFieldDataflow.cs4
-rw-r--r--test/Mono.Linker.Tests.Cases/DataFlow/AttributePropertyDataflow.cs4
3 files changed, 12 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/AttributeConstructorDataflow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/AttributeConstructorDataflow.cs
index 0830d9fcd..7f73071d4 100644
--- a/test/Mono.Linker.Tests.Cases/DataFlow/AttributeConstructorDataflow.cs
+++ b/test/Mono.Linker.Tests.Cases/DataFlow/AttributeConstructorDataflow.cs
@@ -18,6 +18,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow
[KeptAttributeAttribute (typeof (KeepsPublicMethodsAttribute))]
[KeepsPublicConstructor (typeof (ClassWithKeptPublicConstructor))]
[KeepsPublicMethods ("Mono.Linker.Tests.Cases.DataFlow.AttributeConstructorDataflow+ClassWithKeptPublicMethods")]
+ // Trimmer only for now - https://github.com/dotnet/linker/issues/2273
+ [ExpectedWarning ("IL2026", "--ClassWithKeptPublicMethods--", ProducedBy = ProducedBy.Trimmer)]
public static void Main ()
{
typeof (AttributeConstructorDataflow).GetMethod ("Main").GetCustomAttribute (typeof (KeepsPublicConstructorAttribute));
@@ -66,6 +68,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow
class ClassWithKeptPublicMethods
{
[Kept]
+ [KeptAttributeAttribute (typeof (RequiresUnreferencedCodeAttribute))]
+ [RequiresUnreferencedCode ("--ClassWithKeptPublicMethods--")]
public static void KeptMethod () { }
static void Method () { }
}
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/AttributeFieldDataflow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/AttributeFieldDataflow.cs
index ef8304a37..44c857b74 100644
--- a/test/Mono.Linker.Tests.Cases/DataFlow/AttributeFieldDataflow.cs
+++ b/test/Mono.Linker.Tests.Cases/DataFlow/AttributeFieldDataflow.cs
@@ -18,6 +18,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow
[KeptAttributeAttribute (typeof (KeepsPublicMethodsAttribute))]
[KeepsPublicConstructors (Type = typeof (ClassWithKeptPublicConstructor))]
[KeepsPublicMethods ("Mono.Linker.Tests.Cases.DataFlow.AttributeFieldDataflow+ClassWithKeptPublicMethods")]
+ // Trimmer only for now - https://github.com/dotnet/linker/issues/2273
+ [ExpectedWarning ("IL2026", "--ClassWithKeptPublicMethods--", ProducedBy = ProducedBy.Trimmer)]
public static void Main ()
{
typeof (AttributeFieldDataflow).GetMethod ("Main").GetCustomAttribute (typeof (KeepsPublicConstructorsAttribute));
@@ -67,6 +69,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow
class ClassWithKeptPublicMethods
{
[Kept]
+ [KeptAttributeAttribute (typeof (RequiresUnreferencedCodeAttribute))]
+ [RequiresUnreferencedCode ("--ClassWithKeptPublicMethods--")]
public static void KeptMethod () { }
static void Method () { }
}
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/AttributePropertyDataflow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/AttributePropertyDataflow.cs
index 570dc1239..e6848fa5d 100644
--- a/test/Mono.Linker.Tests.Cases/DataFlow/AttributePropertyDataflow.cs
+++ b/test/Mono.Linker.Tests.Cases/DataFlow/AttributePropertyDataflow.cs
@@ -18,6 +18,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow
[KeptAttributeAttribute (typeof (KeepsPublicMethodsAttribute))]
[KeepsPublicConstructors (Type = typeof (ClassWithKeptPublicConstructor))]
[KeepsPublicMethods ("Mono.Linker.Tests.Cases.DataFlow.AttributePropertyDataflow+ClassWithKeptPublicMethods")]
+ // Trimmer only for now - https://github.com/dotnet/linker/issues/2273
+ [ExpectedWarning ("IL2026", "--ClassWithKeptPublicMethods--", ProducedBy = ProducedBy.Trimmer)]
public static void Main ()
{
typeof (AttributePropertyDataflow).GetMethod ("Main").GetCustomAttribute (typeof (KeepsPublicConstructorsAttribute));
@@ -68,6 +70,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow
class ClassWithKeptPublicMethods
{
[Kept]
+ [KeptAttributeAttribute (typeof (RequiresUnreferencedCodeAttribute))]
+ [RequiresUnreferencedCode ("--ClassWithKeptPublicMethods--")]
public static void KeptMethod () { }
static void Method () { }
}