From 862f518fc2e46de3685715fb2cda34d3f3fc3670 Mon Sep 17 00:00:00 2001 From: Friedrich von Never Date: Sat, 18 Nov 2023 22:04:57 +0100 Subject: [PATCH] (#354) Tests: fix for unsafe class --- .../CodeGenNetInteropTests.cs | 2 +- ...rInterop_architecture=Dynamic.verified.txt | 21 +++++++++++++++++++ ...nterInterop_architecture=Wide.verified.txt | 21 +++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 Cesium.CodeGen.Tests/verified/CodeGenNetInteropTests.FunctionPointerInterop_architecture=Dynamic.verified.txt create mode 100644 Cesium.CodeGen.Tests/verified/CodeGenNetInteropTests.FunctionPointerInterop_architecture=Wide.verified.txt diff --git a/Cesium.CodeGen.Tests/CodeGenNetInteropTests.cs b/Cesium.CodeGen.Tests/CodeGenNetInteropTests.cs index c63c2030..a83f9a39 100644 --- a/Cesium.CodeGen.Tests/CodeGenNetInteropTests.cs +++ b/Cesium.CodeGen.Tests/CodeGenNetInteropTests.cs @@ -118,7 +118,7 @@ int main(void) public Task FunctionPointerInterop(TargetArchitectureSet architecture) => DoTest( architecture, """ -public static class Test +public static unsafe class Test { public static int Func(delegate* ptr) => 1; } diff --git a/Cesium.CodeGen.Tests/verified/CodeGenNetInteropTests.FunctionPointerInterop_architecture=Dynamic.verified.txt b/Cesium.CodeGen.Tests/verified/CodeGenNetInteropTests.FunctionPointerInterop_architecture=Dynamic.verified.txt new file mode 100644 index 00000000..c824729d --- /dev/null +++ b/Cesium.CodeGen.Tests/verified/CodeGenNetInteropTests.FunctionPointerInterop_architecture=Dynamic.verified.txt @@ -0,0 +1,21 @@ +Module: Primary + Type: + Methods: + System.Int32 ::myFunc() + IL_0000: ldc.i4.0 + IL_0001: ret + + System.Int32 ::main() + IL_0000: ldftn System.Int32 ::myFunc() + IL_0006: call System.Int32 Test::Func(method System.Int32 *()) + IL_000b: ret + + System.Int32 ::() + Locals: + System.Int32 V_0 + IL_0000: call System.Int32 ::main() + IL_0005: stloc.s V_0 + IL_0007: ldloc.s V_0 + IL_0009: call System.Void Cesium.Runtime.RuntimeHelpers::Exit(System.Int32) + IL_000e: ldloc.s V_0 + IL_0010: ret diff --git a/Cesium.CodeGen.Tests/verified/CodeGenNetInteropTests.FunctionPointerInterop_architecture=Wide.verified.txt b/Cesium.CodeGen.Tests/verified/CodeGenNetInteropTests.FunctionPointerInterop_architecture=Wide.verified.txt new file mode 100644 index 00000000..c824729d --- /dev/null +++ b/Cesium.CodeGen.Tests/verified/CodeGenNetInteropTests.FunctionPointerInterop_architecture=Wide.verified.txt @@ -0,0 +1,21 @@ +Module: Primary + Type: + Methods: + System.Int32 ::myFunc() + IL_0000: ldc.i4.0 + IL_0001: ret + + System.Int32 ::main() + IL_0000: ldftn System.Int32 ::myFunc() + IL_0006: call System.Int32 Test::Func(method System.Int32 *()) + IL_000b: ret + + System.Int32 ::() + Locals: + System.Int32 V_0 + IL_0000: call System.Int32 ::main() + IL_0005: stloc.s V_0 + IL_0007: ldloc.s V_0 + IL_0009: call System.Void Cesium.Runtime.RuntimeHelpers::Exit(System.Int32) + IL_000e: ldloc.s V_0 + IL_0010: ret