From 15b613ac76fa2a9a439f10ac9455c6eb1498b03f Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Sun, 25 Sep 2022 23:48:07 +0300 Subject: Improve tests --- test/Spec.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'test/Spec.hs') diff --git a/test/Spec.hs b/test/Spec.hs index cbe73d7..0869b55 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -2,13 +2,19 @@ import Test.HUnit import Control.Monad.Except import Tokenizer ( tokenize ) +import Parser ( parse ) import TestUtils +import Utils -test1 = (runLContext $ tokenize "+ 1 2") - >>= assertEqual "tokenize \"+ 1 2\"" ["+", "1", "2"] +test1 = (runLContext $ tokenize "(+ 1 (- 10 5))") + >>= assertEqual "tokenize" ["(", "+", "1", "(", "-", "10", "5", ")", ")"] + +test2 = (runLContext $ parse ["(", "+", "1", "2", ")"]) + >>= assertEqual "parse" [ASTFunctionCall [ASTSymbol "+", ASTInteger 1, ASTInteger 2]] tests = TestList $ map TestCase [ - test1 + test1, + test2 ] main :: IO () -- cgit v1.3