mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-20 08:01:42 +03:00
test: add extra AST pest tests
Signed-off-by: ljedrz <ljedrz@gmail.com>
This commit is contained in:
parent
d1ee66a747
commit
88bd491684
@ -64,6 +64,32 @@ fn empty_def() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn returning_unit_type() {
|
||||
parses_to! {
|
||||
parser: LanguageParser,
|
||||
input: "function x() -> () {}",
|
||||
rule: Rule::function,
|
||||
tokens: [
|
||||
function(0, 21, [identifier(9, 10, []), type_(16, 18, [type_tuple(16, 18, [])])])
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn returning_unit_value() {
|
||||
parses_to! {
|
||||
parser: LanguageParser,
|
||||
input: "function x() { return () }",
|
||||
rule: Rule::function,
|
||||
tokens: [
|
||||
function(0, 26, [identifier(9, 10, []), statement(15, 25, [
|
||||
statement_return(15, 25, [expression(22, 25, [expression_term(22, 24, [expression_tuple(22, 24, [])])])])
|
||||
])])
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn id_def() {
|
||||
parses_to! {
|
||||
|
Loading…
Reference in New Issue
Block a user