File tree Expand file tree Collapse file tree 4 files changed +78
-0
lines changed
Mono.Linker.Tests.Cases/FunctionPointers
Mono.Linker.Tests/TestCases Expand file tree Collapse file tree 4 files changed +78
-0
lines changed Original file line number Diff line number Diff line change 1+ // Licensed to the .NET Foundation under one or more agreements.
2+ // The .NET Foundation licenses this file to you under the MIT license.
3+
4+ using Mono . Linker . Tests . Cases . Expectations . Assertions ;
5+ using Mono . Linker . Tests . Cases . Expectations . Metadata ;
6+
7+ namespace Mono . Linker . Tests . Cases . FunctionPointers
8+ {
9+ [ SetupCompileArgument ( "/unsafe" ) ]
10+ unsafe class CanCompileInterfaceWithFunctionPointerParameter
11+ {
12+ public static void Main ( )
13+ {
14+ new CanCompileInterfaceWithFunctionPointerParameter . B ( ) . Method ( null ) ;
15+ }
16+
17+ [ KeptMember ( ".ctor()" ) ]
18+ class B : I
19+ {
20+ public void Unused ( delegate * unmanaged< void > fnptr )
21+ {
22+ }
23+
24+ [ Kept ]
25+ public void Method ( delegate * unmanaged< void > fnptr )
26+ {
27+ }
28+ }
29+
30+ interface I
31+ {
32+ void Unused ( delegate * unmanaged< void > fnptr ) ;
33+
34+ void Method ( delegate * unmanaged< void > fnptr ) ;
35+ }
36+ }
37+ }
Original file line number Diff line number Diff line change 1+ // Licensed to the .NET Foundation under one or more agreements.
2+ // The .NET Foundation licenses this file to you under the MIT license.
3+
4+ using Mono . Linker . Tests . Cases . Expectations . Assertions ;
5+ using Mono . Linker . Tests . Cases . Expectations . Metadata ;
6+
7+ namespace Mono . Linker . Tests . Cases . FunctionPointers
8+ {
9+ [ SetupCompileArgument ( "/unsafe" ) ]
10+ unsafe class CanCompileMethodWithFunctionPointerParameter
11+ {
12+ public static void Main ( )
13+ {
14+ new CanCompileMethodWithFunctionPointerParameter . B ( ) . Method ( null ) ;
15+ }
16+
17+ [ KeptMember ( ".ctor()" ) ]
18+ class B
19+ {
20+ public void Unused ( delegate * unmanaged< void > fnptr )
21+ {
22+ }
23+
24+ [ Kept ]
25+ public void Method ( delegate * unmanaged< void > fnptr )
26+ {
27+ }
28+ }
29+ }
30+ }
Original file line number Diff line number Diff line change @@ -86,6 +86,11 @@ public static IEnumerable<TestCaseData> FeatureSettingsTests ()
8686 return NUnitCasesBySuiteName ( "FeatureSettings" ) ;
8787 }
8888
89+ public static IEnumerable < TestCaseData > FunctionPointersTests ( )
90+ {
91+ return NUnitCasesBySuiteName ( "FunctionPointers" ) ;
92+ }
93+
8994 public static IEnumerable < TestCaseData > GenericsTests ( )
9095 {
9196 return NUnitCasesBySuiteName ( "Generics" ) ;
Original file line number Diff line number Diff line change @@ -103,6 +103,12 @@ public void FeatureSettingsTests (TestCase testCase)
103103 Run ( testCase ) ;
104104 }
105105
106+ [ TestCaseSource ( typeof ( TestDatabase ) , nameof ( TestDatabase . FunctionPointersTests ) ) ]
107+ public void FunctionPointerTests ( TestCase testCase )
108+ {
109+ Run ( testCase ) ;
110+ }
111+
106112 [ TestCaseSource ( typeof ( TestDatabase ) , nameof ( TestDatabase . GenericsTests ) ) ]
107113 public void GenericsTests ( TestCase testCase )
108114 {
You can’t perform that action at this time.
0 commit comments