From 1a8423535a57960db1b4ec3b51c014e655909715 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 8 Oct 2017 21:25:51 -0700 Subject: [PATCH] Add test for function decl --- src/schala_lang/parsing.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/schala_lang/parsing.rs b/src/schala_lang/parsing.rs index 4b16571..df5650e 100644 --- a/src/schala_lang/parsing.rs +++ b/src/schala_lang/parsing.rs @@ -1135,10 +1135,15 @@ mod parse_tests { })])); parse_error!("a(b,,c)"); - parse_test!("fn a(b, c: Int)", AST(vec![Declaration( + parse_test!("fn a(b, c: Int): Int", AST(vec![Declaration( FuncSig(Signature { name: rc!(a), params: vec![ (rc!(b), None), (rc!(c), Some(ty!("Int"))) - ], type_anno: None }))])); + ], type_anno: Some(ty!("Int")) }))])); + + + parse_test!("fn a(x) { x() }", AST(vec![Declaration( + FuncDecl(Signature { name: rc!(a), params: vec![(rc!(x),None)], type_anno: None }, + vec![exprstatement!(Call { name: rc!(x), params: vec![] })]))])); } #[test]