aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-09-14 00:29:13 +0800
committerGitHub <noreply@github.com>2017-09-14 00:29:13 +0800
commit3f3bcc4f8a0d12e9b92d6b63e7cfd92cbbfa775d (patch)
tree5a8f36e2b2491e07534d9c1570b8f40a2235c4c5 /test/libsolidity/SolidityEndToEndTest.cpp
parent72b7e001aa837ab59b3b14bfbabf69bbd102ded1 (diff)
parent172704a58fa2b7562107b8df299c5a81ba702d12 (diff)
downloaddexon-solidity-3f3bcc4f8a0d12e9b92d6b63e7cfd92cbbfa775d.tar.gz
dexon-solidity-3f3bcc4f8a0d12e9b92d6b63e7cfd92cbbfa775d.tar.zst
dexon-solidity-3f3bcc4f8a0d12e9b92d6b63e7cfd92cbbfa775d.zip
Merge pull request #2848 from ethereum/checkViewPure
Enforce view and pure.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 73dd7d22..fa4d675c 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -6525,7 +6525,7 @@ BOOST_AUTO_TEST_CASE(state_variable_under_contract_name)
contract Scope {
uint stateVar = 42;
- function getStateVar() constant returns (uint stateVar) {
+ function getStateVar() view returns (uint stateVar) {
stateVar = Scope.stateVar;
}
}
@@ -6791,7 +6791,7 @@ BOOST_AUTO_TEST_CASE(fixed_arrays_as_return_type)
{
char const* sourceCode = R"(
contract A {
- function f(uint16 input) constant returns (uint16[5] arr)
+ function f(uint16 input) pure returns (uint16[5] arr)
{
arr[0] = input;
arr[1] = ++input;
@@ -6820,7 +6820,7 @@ BOOST_AUTO_TEST_CASE(internal_types_in_library)
{
char const* sourceCode = R"(
library Lib {
- function find(uint16[] storage _haystack, uint16 _needle) constant returns (uint)
+ function find(uint16[] storage _haystack, uint16 _needle) view returns (uint)
{
for (uint i = 0; i < _haystack.length; ++i)
if (_haystack[i] == _needle)
@@ -9913,12 +9913,12 @@ BOOST_AUTO_TEST_CASE(keccak256_assembly)
{
char const* sourceCode = R"(
contract C {
- function f() returns (bytes32 ret) {
+ function f() pure returns (bytes32 ret) {
assembly {
ret := keccak256(0, 0)
}
}
- function g() returns (bytes32 ret) {
+ function g() pure returns (bytes32 ret) {
assembly {
0
0
@@ -9926,12 +9926,12 @@ BOOST_AUTO_TEST_CASE(keccak256_assembly)
=: ret
}
}
- function h() returns (bytes32 ret) {
+ function h() pure returns (bytes32 ret) {
assembly {
ret := sha3(0, 0)
}
}
- function i() returns (bytes32 ret) {
+ function i() pure returns (bytes32 ret) {
assembly {
0
0
@@ -9979,7 +9979,7 @@ BOOST_AUTO_TEST_CASE(inlineasm_empty_let)
{
char const* sourceCode = R"(
contract C {
- function f() returns (uint a, uint b) {
+ function f() pure returns (uint a, uint b) {
assembly {
let x
let y, z
@@ -9998,13 +9998,13 @@ BOOST_AUTO_TEST_CASE(bare_call_invalid_address)
char const* sourceCode = R"(
contract C {
/// Calling into non-existant account is successful (creates the account)
- function f() external constant returns (bool) {
+ function f() external view returns (bool) {
return address(0x4242).call();
}
- function g() external constant returns (bool) {
+ function g() external view returns (bool) {
return address(0x4242).callcode();
}
- function h() external constant returns (bool) {
+ function h() external view returns (bool) {
return address(0x4242).delegatecall();
}
}
@@ -10023,16 +10023,16 @@ BOOST_AUTO_TEST_CASE(delegatecall_return_value)
function set(uint _value) external {
value = _value;
}
- function get() external constant returns (uint) {
+ function get() external view returns (uint) {
return value;
}
- function get_delegated() external constant returns (bool) {
+ function get_delegated() external view returns (bool) {
return this.delegatecall(bytes4(sha3("get()")));
}
- function assert0() external constant {
+ function assert0() external view {
assert(value == 0);
}
- function assert0_delegated() external constant returns (bool) {
+ function assert0_delegated() external view returns (bool) {
return this.delegatecall(bytes4(sha3("assert0()")));
}
}