mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Extract yul syntax tests: multiple assignment expression
This commit is contained in:
parent
99d18336a0
commit
5b799b01ab
@ -126,26 +126,6 @@ do \
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(YulParser)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(multiple_assignment)
|
||||
{
|
||||
CHECK_ERROR("{ let x:u256 function f() -> a:u256, b:u256 {} 123:u256, x := f() }", ParserError, "Variable name must precede \",\" in multiple assignment.");
|
||||
CHECK_ERROR("{ let x:u256 function f() -> a:u256, b:u256 {} x, 123:u256 := f() }", ParserError, "Variable name must precede \":=\" in assignment.");
|
||||
|
||||
/// NOTE: Travis hiccups if not having a variable
|
||||
char const* text = R"(
|
||||
{
|
||||
function f(a:u256) -> r1:u256, r2:u256 {
|
||||
r1 := a
|
||||
r2 := 7:u256
|
||||
}
|
||||
let x:u256 := 9:u256
|
||||
let y:u256 := 2:u256
|
||||
x, y := f(x)
|
||||
}
|
||||
)";
|
||||
BOOST_CHECK(successParse(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(function_defined_in_init_block)
|
||||
{
|
||||
auto const& dialect = EVMDialect::strictAssemblyForEVMObjects(EVMVersion{});
|
||||
|
9
test/libyul/yulSyntaxTests/multiple_assignment_1.yul
Normal file
9
test/libyul/yulSyntaxTests/multiple_assignment_1.yul
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
let x:u256
|
||||
function f() -> a:u256, b:u256 {}
|
||||
123:u256, x := f()
|
||||
}
|
||||
// ====
|
||||
// dialect: evmTyped
|
||||
// ----
|
||||
// ParserError 2856: (58-59): Variable name must precede "," in multiple assignment.
|
9
test/libyul/yulSyntaxTests/multiple_assignment_2.yul
Normal file
9
test/libyul/yulSyntaxTests/multiple_assignment_2.yul
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
let x:u256
|
||||
function f() -> a:u256, b:u256 {}
|
||||
x, 123:u256 := f()
|
||||
}
|
||||
// ====
|
||||
// dialect: evmTyped
|
||||
// ----
|
||||
// ParserError 2856: (62-64): Variable name must precede ":=" in assignment.
|
12
test/libyul/yulSyntaxTests/multiple_assignment_3.yul
Normal file
12
test/libyul/yulSyntaxTests/multiple_assignment_3.yul
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
function f(a:u256) -> r1:u256, r2:u256 {
|
||||
r1 := a
|
||||
r2 := 7:u256
|
||||
}
|
||||
let x:u256 := 9:u256
|
||||
let y:u256 := 2:u256
|
||||
x, y := f(x)
|
||||
}
|
||||
// ====
|
||||
// dialect: evmTyped
|
||||
// ----
|
Loading…
Reference in New Issue
Block a user