From 84deb3a29da6a881a83592b4c8d821591ab3c548 Mon Sep 17 00:00:00 2001 From: xermicus Date: Thu, 27 Feb 2025 10:37:37 +0100 Subject: [PATCH] integration: add function return type test (#244) Closes #236 --- crates/integration/contracts/FunctionType.sol | 36 +++++++++++++++++++ crates/integration/src/tests.rs | 1 + 2 files changed, 37 insertions(+) create mode 100644 crates/integration/contracts/FunctionType.sol diff --git a/crates/integration/contracts/FunctionType.sol b/crates/integration/contracts/FunctionType.sol new file mode 100644 index 0000000..f95d200 --- /dev/null +++ b/crates/integration/contracts/FunctionType.sol @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.28; + +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "FunctionType" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b8c9d365" + } + } + ] +} +*/ + +contract FunctionType { + uint public immutable x = 42; + + function h() public view returns (function() external view returns (uint)) { + return this.x; + } +} diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index 3b1cac9..def9625 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -56,6 +56,7 @@ test_spec!(transfer, "Transfer", "Transfer.sol"); test_spec!(send, "Send", "Send.sol"); test_spec!(function_pointer, "FunctionPointer", "FunctionPointer.sol"); test_spec!(mload, "MLoad", "MLoad.sol"); +test_spec!(function_type, "FunctionType", "FunctionType.sol"); fn instantiate(path: &str, contract: &str) -> Vec { vec![Instantiate {