From: Mike D. Lowis Date: Thu, 2 Aug 2012 20:18:31 +0000 (-0400) Subject: Added unit test to test new function definition syntax X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=7c54157b0388b8b2f4068b25b7cd861b13695703;p=archive%2Fdlang-scm.git Added unit test to test new function definition syntax --- diff --git a/tests/test_parser.scm b/tests/test_parser.scm index 156940c..d1a97ac 100644 --- a/tests/test_parser.scm +++ b/tests/test_parser.scm @@ -165,6 +165,19 @@ (syntree 'id "foo" '()) (syntree 'number "1.0" '()))))))) +(def-test "dlang/define should parse a function definition" + (call-with-input-string "def foo() 1.0;" + (lambda (input) + (define lxr (dlang/lexer input)) + (define result (dlang/define lxr)) + (syntree=? result + (syntree 'define "" + (list (syntree 'id "foo" '()) + (syntree 'func "" + (list (syntree 'args "" '()) + (syntree 'block "" + (list (syntree 'number "1.0" '()))))))))))) + (def-test "dlang/define should error when no terminator found" (call-with-input-string "def foo 1.0" (lambda (input)