aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-06-27 19:15:51 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-09-13 18:40:57 +0800
commit88946f9f03625fab345572c66b33ee3e05a07159 (patch)
tree329ca01f3e44018d0c3b328b155ddae8554649e9 /test/libsolidity/SolidityEndToEndTest.cpp
parent58f7a27ee0336423fa7dc76b8a160b78301bbdd2 (diff)
downloaddexon-solidity-88946f9f03625fab345572c66b33ee3e05a07159.tar
dexon-solidity-88946f9f03625fab345572c66b33ee3e05a07159.tar.gz
dexon-solidity-88946f9f03625fab345572c66b33ee3e05a07159.tar.bz2
dexon-solidity-88946f9f03625fab345572c66b33ee3e05a07159.tar.lz
dexon-solidity-88946f9f03625fab345572c66b33ee3e05a07159.tar.xz
dexon-solidity-88946f9f03625fab345572c66b33ee3e05a07159.tar.zst
dexon-solidity-88946f9f03625fab345572c66b33ee3e05a07159.zip
Add tests for function type sigs
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 73dd7d22..f3d0fde3 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -10051,6 +10051,30 @@ BOOST_AUTO_TEST_CASE(delegatecall_return_value)
BOOST_CHECK(callContractFunction("get_delegated()") == encodeArgs(u256(1)));
}
+BOOST_AUTO_TEST_CASE(function_types_sig)
+{
+ char const* sourceCode = R"(
+ contract C {
+ function f() returns (bytes4) {
+ return this.f.sig;
+ }
+ function g() returns (bytes4) {
+ function () external returns (bytes4) fun = this.f;
+ return fun.sig;
+ }
+ function h() returns (bytes4) {
+ function () external returns (bytes4) fun = this.f;
+ var funvar = fun;
+ return funvar.sig;
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "C");
+ BOOST_CHECK(callContractFunction("f()") == fromHex("0x26121ff0"));
+ BOOST_CHECK(callContractFunction("g()") == fromHex("0x26121ff0"));
+ BOOST_CHECK(callContractFunction("h()") == fromHex("0x26121ff0"));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}