Browse Source

Add multiple functions test

github-actions
Garrit Franke 2 years ago
parent
commit
85edec21dd
  1. 18
      src/parser/tests.rs

18
src/parser/tests.rs

@ -42,6 +42,24 @@ fn test_parse_no_function_context() {
assert!(tree.is_err())
}
#[test]
fn test_parse_multiple_functions() {
let raw = "
fn foo() {
let x = 2;
return x;
}
fn bar() {
let y = 5;
return y;
}
";
let tokens = tokenize(raw);
let tree = parse(tokens);
assert!(tree.is_ok())
}
#[test]
fn test_parse_variable_declaration() {
let raw = "

Loading…
Cancel
Save