From 98e588f14fc363c6c9674a37a556c864dc65548c Mon Sep 17 00:00:00 2001 From: "Mike D. Lowis" Date: Fri, 27 Jul 2012 16:00:56 -0400 Subject: [PATCH] add tests for token-matches? --- tests/test_parse_utils.scm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_parse_utils.scm b/tests/test_parse_utils.scm index b654899..7b1229f 100644 --- a/tests/test_parse_utils.scm +++ b/tests/test_parse_utils.scm @@ -128,6 +128,23 @@ ; 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 ;------------------------------------------------------------------------------ -- 2.52.0