aboutsummaryrefslogtreecommitdiffstats
path: root/test/Spec.hs
blob: 0869b55b6cf0c77ef4d3a80a3bdae7b503c3ea0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{-# OPTIONS_GHC -Wno-missing-signatures #-}
import Test.HUnit
import Control.Monad.Except
import Tokenizer ( tokenize )
import Parser ( parse )
import TestUtils
import Utils

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,
    test2
    ]

main :: IO ()
main = void $ runTestTT tests