aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-07-12 19:14:02 +0800
committerGitHub <noreply@github.com>2018-07-12 19:14:02 +0800
commitfa8102880f87c5a2806d59f959fd3e8a62dd4dc9 (patch)
treee6e76488612e182389fc02fcb9e57f4b112a248d /test
parent576f3ef18c47c13b92e5b604d19f99018b0300b0 (diff)
parent38026d311443f5f0f8fb23a928839136b56c97bd (diff)
downloaddexon-solidity-fa8102880f87c5a2806d59f959fd3e8a62dd4dc9.tar.gz
dexon-solidity-fa8102880f87c5a2806d59f959fd3e8a62dd4dc9.tar.zst
dexon-solidity-fa8102880f87c5a2806d59f959fd3e8a62dd4dc9.zip
Merge pull request #4428 from ethereum/enforce_staticcall_view
[BREAKING] Enforce STATICCALL for view and pure
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp38
1 files changed, 37 insertions, 1 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index d4ed50f6..31412108 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -12487,7 +12487,6 @@ BOOST_AUTO_TEST_CASE(abi_encode_call)
BOOST_AUTO_TEST_CASE(staticcall_for_view_and_pure)
{
char const* sourceCode = R"(
- pragma experimental "v0.5.0";
contract C {
uint x;
function f() public returns (uint) {
@@ -12722,6 +12721,43 @@ BOOST_AUTO_TEST_CASE(senders_balance)
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(27)));
}
+BOOST_AUTO_TEST_CASE(write_storage_external)
+{
+ char const* sourceCode = R"(
+ contract C {
+ uint public x;
+ function f(uint y) public payable {
+ x = y;
+ }
+ function g(uint y) external {
+ x = y;
+ }
+ function h() public {
+ this.g(12);
+ }
+ }
+ contract D {
+ C c = new C();
+ function f() public payable returns (uint) {
+ c.g(3);
+ return c.x();
+ }
+ function g() public returns (uint) {
+ c.g(8);
+ return c.x();
+ }
+ function h() public returns (uint) {
+ c.h();
+ return c.x();
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "D");
+ ABI_CHECK(callContractFunction("f()"), encodeArgs(3));
+ ABI_CHECK(callContractFunction("g()"), encodeArgs(8));
+ ABI_CHECK(callContractFunction("h()"), encodeArgs(12));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}