mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Some tests.
This commit is contained in:
parent
0407b1c697
commit
af339ed202
24
test/libsolidity/semanticTests/modifiers/many_simple.sol
Normal file
24
test/libsolidity/semanticTests/modifiers/many_simple.sol
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
contract C {
|
||||||
|
uint256 public x;
|
||||||
|
modifier m() {
|
||||||
|
x ++;
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
modifier mdouble() {
|
||||||
|
_;
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
function f() public m m m m m m m m m m mdouble m m m m m m m m m m m m m m m m returns (uint) {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ====
|
||||||
|
// compileToEwasm: also
|
||||||
|
// compileViaYul: also
|
||||||
|
// ----
|
||||||
|
// x() -> 0
|
||||||
|
// f() -> 0x2a
|
||||||
|
// x() -> 0x2a
|
@ -0,0 +1,26 @@
|
|||||||
|
contract C {
|
||||||
|
uint256 public x;
|
||||||
|
modifier m1() {
|
||||||
|
x = 1;
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
modifier m2(bool abort) {
|
||||||
|
if (abort) return;
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
function f(bool abort) public m1 m2(abort) {
|
||||||
|
x += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ====
|
||||||
|
// compileToEwasm: also
|
||||||
|
// compileViaYul: also
|
||||||
|
// ----
|
||||||
|
// x() -> 0
|
||||||
|
// f(bool): false ->
|
||||||
|
// x() -> 3
|
||||||
|
// f(bool): true ->
|
||||||
|
// x() -> 1
|
Loading…
Reference in New Issue
Block a user