Extract yul syntax tests: multiple assignment expression

This commit is contained in:
Christian Parpart 2020-10-14 11:50:25 +02:00
parent 99d18336a0
commit 5b799b01ab
4 changed files with 30 additions and 20 deletions

View File

@ -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{});

View 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.

View 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.

View 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
// ----