Merge pull request #7093 from ethereum/isoltest-constructor-value

[isoltest] Pass ether along with constructor
This commit is contained in:
chriseth 2019-07-16 10:03:46 +02:00 committed by GitHub
commit a5a7983af7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -80,7 +80,7 @@ TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePref
{
if (&test == &m_tests.front())
if (test.call().isConstructor)
deploy("", 0, test.call().arguments.rawBytes());
deploy("", test.call().value, test.call().arguments.rawBytes());
else
soltestAssert(deploy("", 0, bytes()), "Failed to deploy contract.");
else

View File

@ -1,8 +1,11 @@
contract C {
uint public state = 0;
constructor(uint _state) public {
constructor(uint _state) public payable {
state = _state;
}
function balance() payable public returns (uint256) {
return address(this).balance;
}
function f() payable public returns (uint) {
return 2;
}
@ -38,8 +41,9 @@ contract C {
}
}
// ----
// constructor(): 3 ->
// constructor(), 2 ether: 3 ->
// state() -> 3
// balance() -> 2
// _() -> FAILURE
// f() -> 2
// f(), 1 ether -> 2