Merge pull request #7699 from ethereum/test-require-str

Test `require` with string literals
This commit is contained in:
chriseth 2019-11-13 12:20:23 +01:00 committed by GitHub
commit c0cf96cbc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 4 deletions

View File

@ -5,4 +5,4 @@
"compiler-fixed": "off",
"no-inline-assembly": "off"
}
}
}

View File

@ -12,17 +12,33 @@ contract C {
x = true;
require(true);
}
/* Not properly supported by test system yet
function f2(bool a) public pure returns (bool x) {
x = a;
string memory message;
message = "fancy message!";
require(a, message);
}*/
}
function f3(bool a) public pure returns (bool x) {
x = a;
require(a, "msg");
}
function f4(bool a) public pure returns (bool x) {
x = a;
string memory message;
require(a, message);
}
}
// ====
// compileViaYul: true
// compileViaYul: also
// EVMVersion: >=byzantium
// ----
// f(bool): true -> true
// f(bool): false -> FAILURE
// fail() -> FAILURE
// succeed() -> true
// f2(bool): true -> true
// f2(bool): false -> FAILURE, hex"08c379a0", 0x20, 14, "fancy message!"
// f3(bool): true -> true
// f3(bool): false -> FAILURE, hex"08c379a0", 0x20, 3, "msg"
// f4(bool): true -> true
// f4(bool): false -> FAILURE, hex"08c379a0", 0x20, 0