mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4562 from ethereum/parser-tests
Add comprehensive tests for the parser
This commit is contained in:
commit
05e608d778
7
test/libsolidity/syntaxTests/emit_empty.sol
Normal file
7
test/libsolidity/syntaxTests/emit_empty.sol
Normal file
@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public {
|
||||
emit;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError: (45-46): Expected event name or path.
|
@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly "evmasm" {}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly "failasm" {}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError: (55-64): Only "evmasm" supported.
|
3
test/libsolidity/syntaxTests/parsing/import_complex.sol
Normal file
3
test/libsolidity/syntaxTests/parsing/import_complex.sol
Normal file
@ -0,0 +1,3 @@
|
||||
import {hello, world} from "hello";
|
||||
// ----
|
||||
// ParserError: (0-35): Source "hello" not found: File not supplied initially.
|
@ -0,0 +1,3 @@
|
||||
import {hello, world} from function;
|
||||
// ----
|
||||
// ParserError: (27-35): Expected import path.
|
@ -0,0 +1,3 @@
|
||||
import {hello, world};
|
||||
// ----
|
||||
// ParserError: (21-22): Expected "from".
|
@ -0,0 +1,3 @@
|
||||
import function;
|
||||
// ----
|
||||
// ParserError: (7-15): Expected string literal (path), "*" or alias list.
|
3
test/libsolidity/syntaxTests/parsing/import_simple.sol
Normal file
3
test/libsolidity/syntaxTests/parsing/import_simple.sol
Normal file
@ -0,0 +1,3 @@
|
||||
import "hello";
|
||||
// ----
|
||||
// ParserError: (0-15): Source "hello" not found: File not supplied initially.
|
@ -0,0 +1,12 @@
|
||||
contract Foo {
|
||||
uint[] m_x;
|
||||
function f() public view {
|
||||
uint[] storage memory x = m_x;
|
||||
uint[] memory storage calldata y;
|
||||
x; y;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError: (85-91): Location already specified.
|
||||
// ParserError: (123-130): Location already specified.
|
||||
// ParserError: (131-139): Location already specified.
|
@ -0,0 +1,6 @@
|
||||
contract Foo {
|
||||
function f(uint[] storage memory constant x, uint[] memory calldata y) internal { }
|
||||
}
|
||||
// ----
|
||||
// ParserError: (45-51): Location already specified.
|
||||
// ParserError: (78-86): Location already specified.
|
@ -0,0 +1,5 @@
|
||||
contract Foo {
|
||||
uint[] memory storage calldata x;
|
||||
}
|
||||
// ----
|
||||
// ParserError: (23-29): Expected identifier but got 'memory'
|
4
test/libsolidity/syntaxTests/parsing/pragma_illegal.sol
Normal file
4
test/libsolidity/syntaxTests/parsing/pragma_illegal.sol
Normal file
@ -0,0 +1,4 @@
|
||||
pragma ``;
|
||||
// ----
|
||||
// ParserError: (7-8): Token incompatible with Solidity parser as part of pragma directive.
|
||||
// ParserError: (8-9): Token incompatible with Solidity parser as part of pragma directive.
|
Loading…
Reference in New Issue
Block a user