Skip to content

Commit c74b1da

Browse files
committed
Test require with string literals
fixes ethereum#6651
1 parent 50a015a commit c74b1da

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

test/.solhint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"compiler-fixed": "off",
66
"no-inline-assembly": "off"
77
}
8-
}
8+
}

test/libsolidity/semanticTests/viaYul/require.sol

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,33 @@ contract C {
1212
x = true;
1313
require(true);
1414
}
15-
/* Not properly supported by test system yet
1615
function f2(bool a) public pure returns (bool x) {
1716
x = a;
1817
string memory message;
18+
message = "fancy message!";
1919
require(a, message);
20-
}*/
20+
}
21+
function f3(bool a) public pure returns (bool x) {
22+
x = a;
23+
require(a, "msg");
24+
}
25+
function f4(bool a) public pure returns (bool x) {
26+
x = a;
27+
string memory message;
28+
require(a, message);
29+
}
2130
}
2231
// ====
23-
// compileViaYul: true
32+
// compileViaYul: also
33+
// EVMVersion: >=byzantium
2434
// ----
2535
// f(bool): true -> true
2636
// f(bool): false -> FAILURE
2737
// fail() -> FAILURE
2838
// succeed() -> true
39+
// f2(bool): true -> true
40+
// f2(bool): false -> FAILURE, hex"08c379a0", 0x20, 14, "fancy message!"
41+
// f3(bool): true -> true
42+
// f3(bool): false -> FAILURE, hex"08c379a0", 0x20, 3, "msg"
43+
// f4(bool): true -> true
44+
// f4(bool): false -> FAILURE, hex"08c379a0", 0x20, 0

0 commit comments

Comments
 (0)