]> git.mdlowis.com Git - archive/dlang-scm.git/commitdiff
Added tests for dlang/core-form?
authorMike D. Lowis <mike@mdlowis.com>
Thu, 19 Jul 2012 00:10:04 +0000 (20:10 -0400)
committerMike D. Lowis <mike@mdlowis.com>
Thu, 19 Jul 2012 00:10:04 +0000 (20:10 -0400)
tests/test_parser.scm

index a2ef1f609c8adbd877d448149cd8f66eb10db718..f8ad857a2431c17a54624dd8ad9793450a9db2ff 100644 (file)
             (syntree 'args "" '())
             (syntree 'block "" '())))))))
 
+; dlang/core-form?
+;------------------------------------------------------------------------------
+(def-test "dlang/core-form? should recognize def as a core form"
+  (call-with-input-string "def"
+    (lambda (input)
+      (define lxr (make-lexer input))
+      (equal? #t (dlang/core-form? lxr)))))
+
+(def-test "dlang/core-form? should recognize set! as a core form"
+  (call-with-input-string "set!"
+    (lambda (input)
+      (define lxr (make-lexer input))
+      (equal? #t (dlang/core-form? lxr)))))
+
+(def-test "dlang/core-form? should recognize def as a core form"
+  (call-with-input-string "if"
+    (lambda (input)
+      (define lxr (make-lexer input))
+      (equal? #t (dlang/core-form? lxr)))))
+
+(def-test "dlang/core-form? should recognize def as a core form"
+  (call-with-input-string "begin"
+    (lambda (input)
+      (define lxr (make-lexer input))
+      (equal? #t (dlang/core-form? lxr)))))
+
+(def-test "dlang/core-form? should recognize def as a core form"
+  (call-with-input-string "func"
+    (lambda (input)
+      (define lxr (make-lexer input))
+      (equal? #t (dlang/core-form? lxr)))))
+
+(def-test "dlang/core-form? should return false for non-coreform"
+  (call-with-input-string "foo"
+    (lambda (input)
+      (define lxr (make-lexer input))
+      (equal? #f (dlang/core-form? lxr)))))
+
 ; dlang/define
 ;------------------------------------------------------------------------------
 (def-test "dlang/define should parse a variable definition"