-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Pull in tests from iltrim prototype #126275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...zer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/MultiAssemblyTests.g.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| using System; | ||
| using System.Threading.Tasks; | ||
| using Xunit; | ||
|
|
||
| namespace ILLink.RoslynAnalyzer.Tests | ||
| { | ||
| public sealed partial class MultiAssemblyTests : LinkerTestBase | ||
| { | ||
|
|
||
| protected override string TestSuiteName => "MultiAssembly"; | ||
|
|
||
| [Fact] | ||
| public Task ForwarderReference() | ||
| { | ||
| return RunTest(allowMissingWarnings: true); | ||
| } | ||
|
|
||
| [Fact] | ||
| public Task MultiAssembly() | ||
| { | ||
| return RunTest(allowMissingWarnings: true); | ||
| } | ||
|
|
||
| [Fact] | ||
| public Task TypeRefToAssembly() | ||
| { | ||
| return RunTest(allowMissingWarnings: true); | ||
| } | ||
|
|
||
| } | ||
| } |
28 changes: 28 additions & 0 deletions
28
src/tools/illink/test/Mono.Linker.Tests.Cases/Basic/Calli.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using Mono.Linker.Tests.Cases.Expectations.Assertions; | ||
| using Mono.Linker.Tests.Cases.Expectations.Metadata; | ||
|
|
||
| namespace Mono.Linker.Tests.Cases.Basic | ||
| { | ||
| [SetupCompileArgument("/unsafe")] | ||
| [SkipILVerify] // ILVerify doesn't handle calli | ||
| [KeptMember(".cctor()")] | ||
| public unsafe class Calli | ||
| { | ||
| [Kept] | ||
| private static readonly delegate*<object, void> _pfn = null; | ||
|
|
||
| public static void Main() | ||
| { | ||
| CallCalli(null); | ||
| } | ||
|
|
||
| [Kept] | ||
| static void CallCalli(object o) | ||
| { | ||
| _pfn(o); | ||
| } | ||
| } | ||
| } |
1 change: 1 addition & 0 deletions
1
...ols/illink/test/Mono.Linker.Tests.Cases/Basic/Dependencies/Resources_EmbeddedResource.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Embedded resource content |
52 changes: 52 additions & 0 deletions
52
src/tools/illink/test/Mono.Linker.Tests.Cases/Basic/ExceptionRegions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using Mono.Linker.Tests.Cases.Expectations.Assertions; | ||
|
|
||
| namespace Mono.Linker.Tests.Cases.Basic | ||
| { | ||
| [Kept] | ||
| public class ExceptionRegions | ||
| { | ||
| [Kept] | ||
| static void Main() | ||
| { | ||
| try | ||
| { | ||
| A(); | ||
| } | ||
| catch (CustomException ce) | ||
| { | ||
| Console.WriteLine(ce.Message); | ||
| try | ||
| { | ||
| B(); | ||
| } | ||
| catch (Exception e) when (e.InnerException != null) | ||
| { | ||
| Console.WriteLine(e.Message); | ||
| } | ||
| } | ||
| finally | ||
| { | ||
| C(); | ||
| } | ||
| } | ||
|
|
||
| [Kept] | ||
| static void A() { } | ||
|
|
||
| [Kept] | ||
| static void B() { throw new Exception(); } | ||
|
|
||
| [Kept] | ||
| static void C() { } | ||
| } | ||
|
|
||
| [Kept] | ||
| [KeptBaseType(typeof(Exception))] | ||
| class CustomException : Exception | ||
| { | ||
| } | ||
| } |
13 changes: 13 additions & 0 deletions
13
src/tools/illink/test/Mono.Linker.Tests.Cases/Basic/FieldRVA.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| using System; | ||
| using Mono.Linker.Tests.Cases.Expectations.Assertions; | ||
|
|
||
| namespace Mono.Linker.Tests.Cases.Basic | ||
| { | ||
| [Kept] | ||
| class FieldRVA | ||
| { | ||
| [Kept] | ||
| [KeptInitializerData] | ||
| static int Main() => new byte[] { 1, 2, 3, 4, 5 }.Length; | ||
| } | ||
| } | ||
24 changes: 24 additions & 0 deletions
24
src/tools/illink/test/Mono.Linker.Tests.Cases/Basic/FieldSignature.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| using Mono.Linker.Tests.Cases.Expectations.Assertions; | ||
| using System; | ||
|
|
||
| namespace Mono.Linker.Tests.Cases.Basic | ||
| { | ||
| [Kept] | ||
| class FieldSignature | ||
| { | ||
| [Kept] | ||
| static FieldType field; | ||
|
|
||
| [Kept] | ||
| static void Main() | ||
| { | ||
| field = null; | ||
| _ = field; | ||
| } | ||
|
|
||
| [Kept] | ||
| class FieldType | ||
| { | ||
| } | ||
| } | ||
| } |
33 changes: 33 additions & 0 deletions
33
src/tools/illink/test/Mono.Linker.Tests.Cases/Basic/FieldsOfEnum.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using Mono.Linker.Tests.Cases.Expectations.Assertions; | ||
|
|
||
| namespace Mono.Linker.Tests.Cases.Basic | ||
| { | ||
| [Kept] | ||
| class FieldsOfEnum | ||
| { | ||
| [Kept] | ||
| static void Main() | ||
| { | ||
| Console.WriteLine($"{MyEnum.A}"); | ||
| } | ||
| } | ||
|
|
||
| [Kept] | ||
| [KeptMember("value__")] | ||
| [KeptBaseType(typeof(Enum))] | ||
| public enum MyEnum | ||
| { | ||
| [Kept] | ||
| A = 0, | ||
|
|
||
| [Kept] | ||
| B = 1, | ||
|
|
||
| [Kept] | ||
| C = 2, | ||
| }; | ||
| } |
33 changes: 33 additions & 0 deletions
33
src/tools/illink/test/Mono.Linker.Tests.Cases/Basic/Finalizer.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| using Mono.Linker.Tests.Cases.Expectations.Assertions; | ||
| using System; | ||
|
|
||
| namespace Mono.Linker.Tests.Cases.Basic | ||
| { | ||
| [Kept] | ||
| class Finalizer | ||
| { | ||
| static void Main() | ||
| { | ||
| MentionUnallocatedType(null); | ||
| new AllocatedTypeWithFinalizer(); | ||
| } | ||
|
|
||
| [Kept] | ||
| static void MentionUnallocatedType(UnallocatedTypeWithFinalizer u) { } | ||
|
|
||
| [Kept] | ||
| class UnallocatedTypeWithFinalizer | ||
| { | ||
| // Not kept | ||
| ~UnallocatedTypeWithFinalizer() { } | ||
| } | ||
|
|
||
| [Kept] | ||
| [KeptMember(".ctor()")] | ||
| class AllocatedTypeWithFinalizer | ||
| { | ||
| [Kept] | ||
| ~AllocatedTypeWithFinalizer() { } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation uses tab characters for the type declaration/closing brace; repo .editorconfig sets indent_style=space. Please convert these tabs to spaces to match formatting conventions.