]> git.mdlowis.com Git - archive/dlang-scm.git/commitdiff
add tests for token-matches?
authorMike D. Lowis <mike@mdlowis.com>
Fri, 27 Jul 2012 20:00:56 +0000 (16:00 -0400)
committerMike D. Lowis <mike@mdlowis.com>
Fri, 27 Jul 2012 20:00:56 +0000 (16:00 -0400)
tests/test_parse_utils.scm

index b654899ae1ea4218130421236ec266dbdfe7825c..7b1229f261c2a7d86c60bc157e72a97a952a74cc 100644 (file)
 
 ; token-matches?
 ;------------------------------------------------------------------------------
+(def-test "token-matches? should return true if next token matches type"
+  (call-with-input-string "abc"
+    (lambda (input)
+      (define buffer (dlang/lexer input))
+      (token-matches? buffer 'id))))
+
+(def-test "token-matches? should return false if next token does not match type"
+  (call-with-input-string "ab"
+    (lambda (input)
+      (define buffer (dlang/lexer input))
+      (not (token-matches? buffer 'foo)))))
+
+(def-test "token-matches? should return false if EOF"
+  (call-with-input-string ""
+    (lambda (input)
+      (define buffer (dlang/lexer input))
+      (not (token-matches? buffer 'foo)))))
 
 ; keyword-match
 ;------------------------------------------------------------------------------