1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
using System;
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;
namespace Mono.Linker.Tests.Cases.FeatureSettings
{
[SetupCompileResource ("Dependencies/ResourceFile.txt", "ResourceFileRemoveWhenTrue.txt")]
[SetupCompileResource ("Dependencies/ResourceFile.txt", "ResourceFileRemoveWhenFalse.txt")]
[SetupLinkerSubstitutionFile ("FeatureSubstitutionsGlobalTrue.xml")]
[SetupLinkerSubstitutionFile ("FeatureSubstitutionsGlobalFalse.xml")]
[SetupLinkerSubstitutionFile ("FeatureSubstitutionsNested.xml")]
[SetupLinkerArgument ("--feature", "GlobalCondition", "true")]
[SetupLinkerArgument ("--feature", "AssemblyCondition", "false")]
[SetupLinkerArgument ("--feature", "TypeCondition", "true")]
[SetupLinkerArgument ("--feature", "MethodCondition", "false")]
[SetupLinkerArgument ("--feature", "FieldCondition", "true")]
[SetupLinkerArgument ("--feature", "ResourceCondition", "true")]
[RemovedResourceInAssembly ("test.exe", "ResourceFileRemoveWhenTrue.txt")]
[KeptResource ("ResourceFileRemoveWhenFalse.txt")]
public class FeatureSubstitutionsNested
{
[ExpectedInstructionSequence (new[] {
"nop",
"ldc.i4.1",
"pop",
"ldc.i4.0",
"pop",
"ldc.i4.1",
"pop",
"ldc.i4.0",
"pop",
"ldsfld System.Boolean Mono.Linker.Tests.Cases.FeatureSettings.FeatureSubstitutionsNested::FieldConditionField",
"pop",
"ret",
})]
public static void Main ()
{
GlobalConditionMethod ();
AssemblyConditionMethod ();
TypeConditionMethod ();
MethodConditionMethod ();
_ = FieldConditionField;
}
static bool GlobalConditionMethod ()
{
throw new NotImplementedException ();
}
static bool AssemblyConditionMethod ()
{
throw new NotImplementedException ();
}
static bool TypeConditionMethod ()
{
throw new NotImplementedException ();
}
static bool MethodConditionMethod ()
{
throw new NotImplementedException ();
}
[Kept]
static readonly bool FieldConditionField;
[Kept]
[ExpectedInstructionSequence (new[] {
"nop",
"ldc.i4.1",
"stsfld System.Boolean Mono.Linker.Tests.Cases.FeatureSettings.FeatureSubstitutionsNested::FieldConditionField",
"ret"
})]
static FeatureSubstitutionsNested ()
{
}
}
}
|