mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Some more parsing tests.
This commit is contained in:
parent
2f0826ffd7
commit
ea0a86a995
@ -308,6 +308,20 @@ BOOST_AUTO_TEST_CASE(for_invalid_expression)
|
|||||||
CHECK_PARSE_ERROR("{ for {} mstore(1, 1) {} {} }", ParserError, "Instruction \"mstore\" not allowed in this context");
|
CHECK_PARSE_ERROR("{ for {} mstore(1, 1) {} {} }", ParserError, "Instruction \"mstore\" not allowed in this context");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(for_visibility)
|
||||||
|
{
|
||||||
|
BOOST_CHECK(successParse("{ for { let i := 1 } i { pop(i) } { pop(i) } }"));
|
||||||
|
CHECK_PARSE_ERROR("{ for {} i { let i := 1 } {} }", DeclarationError, "Identifier not found");
|
||||||
|
CHECK_PARSE_ERROR("{ for {} 1 { let i := 1 } { pop(i) } }", DeclarationError, "Identifier not found");
|
||||||
|
CHECK_PARSE_ERROR("{ for {} 1 { pop(i) } { let i := 1 } }", DeclarationError, "Identifier not found");
|
||||||
|
CHECK_PARSE_ERROR("{ for { pop(i) } 1 { let i := 1 } {} }", DeclarationError, "Identifier not found");
|
||||||
|
CHECK_PARSE_ERROR("{ for { pop(i) } 1 { } { let i := 1 } }", DeclarationError, "Identifier not found");
|
||||||
|
CHECK_PARSE_ERROR("{ for {} i {} { let i := 1 } }", DeclarationError, "Identifier not found");
|
||||||
|
CHECK_PARSE_ERROR("{ for {} 1 { pop(i) } { let i := 1 } }", DeclarationError, "Identifier not found");
|
||||||
|
// Check that body and post are not sub-scopes of each other.
|
||||||
|
BOOST_CHECK(successParse("{ for {} 1 { let x := 1 } { let x := 1 } }"));
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(blocks)
|
BOOST_AUTO_TEST_CASE(blocks)
|
||||||
{
|
{
|
||||||
BOOST_CHECK(successParse("{ let x := 7 { let y := 3 } { let z := 2 } }"));
|
BOOST_CHECK(successParse("{ let x := 7 { let y := 3 } { let z := 2 } }"));
|
||||||
|
Loading…
Reference in New Issue
Block a user