diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2022-09-25 23:48:07 +0300 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2022-12-05 14:21:53 +0200 |
| commit | 15b613ac76fa2a9a439f10ac9455c6eb1498b03f (patch) | |
| tree | 9be6b6b4acbf7fc89ea6910985ce26669829393c /test | |
| parent | 82b9e3f4bf70e911916cf000655cdae2492060df (diff) | |
Improve tests
Diffstat (limited to 'test')
| -rw-r--r-- | test/Spec.hs | 12 |
1 files changed, 9 insertions, 3 deletions
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 () |
