]> git.mdlowis.com Git - archive/dlang-scm.git/commitdiff
Added unit test to test new function definition syntax
authorMike D. Lowis <mike@mdlowis.com>
Thu, 2 Aug 2012 20:18:31 +0000 (16:18 -0400)
committerMike D. Lowis <mike@mdlowis.com>
Thu, 2 Aug 2012 20:18:31 +0000 (16:18 -0400)
tests/test_parser.scm

index 156940ce460e88c9f3391e3dd8ac1bb0e6c36530..d1a97ac8ca03e8081af1d571ae097a022a0c75a2 100644 (file)
             (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)