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:
authorJackson Schuster <36744439+jtschuster@users.noreply.github.com>2022-03-19 02:02:30 +0300
committerGitHub <noreply@github.com>2022-03-19 02:02:30 +0300
commit9f2b304f6eb43c32bd7fb6f7cf7b39d5aa677378 (patch)
tree546d65f41deb32a787d22cd5f69ca715dd192d77 /test
parent947f66a100d05d7c829e53fe031a22e532cdb4d2 (diff)
Add tests for analyzer null references in byte array COM interop (#2688)
Diffstat (limited to 'test')
-rw-r--r--test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/InteropTests.g.cs19
-rw-r--r--test/Mono.Linker.Tests.Cases/Interop/ByteArrayCom.cs26
2 files changed, 45 insertions, 0 deletions
diff --git a/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/InteropTests.g.cs b/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/InteropTests.g.cs
new file mode 100644
index 000000000..5f49e5e14
--- /dev/null
+++ b/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/InteropTests.g.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace ILLink.RoslynAnalyzer.Tests
+{
+ public sealed partial class InteropTests : LinkerTestBase
+ {
+
+ protected override string TestSuiteName => "Interop";
+
+ [Fact]
+ public Task ByteArrayCom ()
+ {
+ return RunTest (allowMissingWarnings: true);
+ }
+
+ }
+} \ No newline at end of file
diff --git a/test/Mono.Linker.Tests.Cases/Interop/ByteArrayCom.cs b/test/Mono.Linker.Tests.Cases/Interop/ByteArrayCom.cs
new file mode 100644
index 000000000..af09925b4
--- /dev/null
+++ b/test/Mono.Linker.Tests.Cases/Interop/ByteArrayCom.cs
@@ -0,0 +1,26 @@
+// 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 System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+using Mono.Linker.Tests.Cases.Expectations.Assertions;
+
+namespace Mono.Linker.Tests.Cases.Interop
+{
+ [ExpectedNoWarnings]
+ [SkipKeptItemsValidation]
+ class ByteArrayCom
+ {
+ public static void Main ()
+ {
+ TakesByteArray (new byte[] { });
+ }
+
+ [DllImport ("SampleText.dll")]
+ static extern void TakesByteArray (byte[] x);
+ }
+}